grep `abc\{3,5\}d`file - does what? URGENT!

  • marjeg
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Jan 14, 2007
  • Posts: 8
  • Status: Offline

Post January 14th, 2007, 10:38 am

Hi!

Can anyone help me with what the command
grep `abc\{3,5\}d`file
does? URGENT!

:shock:

Maria from Sweden
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post January 14th, 2007, 10:38 am

  • theak
  • Proficient
  • Proficient
  • User avatar
  • Joined: Jun 11, 2004
  • Posts: 438
  • Loc: Taipei, Taiwan
  • Status: Offline

Post January 14th, 2007, 10:47 am

Grep searches files for a specific string, 'abc\{3,5\}d' in your case, with the file searched called 'file' in your example.
Trust the Monkey
http://www.ironricebowl.com
  • marjeg
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Jan 14, 2007
  • Posts: 8
  • Status: Offline

Post January 14th, 2007, 11:00 am

theak wrote:
Grep searches files for a specific string, 'abc\{3,5\}d' in your case, with the file searched called 'file' in your example.


Thanks for you answer! :)

Do you also know what more specific what does " 'abc\{3,5\}d'" means?

Even for someone like me unix can be quit confusing!
:lol:
  • theak
  • Proficient
  • Proficient
  • User avatar
  • Joined: Jun 11, 2004
  • Posts: 438
  • Loc: Taipei, Taiwan
  • Status: Offline

Post January 14th, 2007, 12:02 pm

It's the text grep is looking for, I have no idea what it could mean...
Trust the Monkey
http://www.ironricebowl.com
  • AnarchY SI
  • Web Master
  • Web Master
  • User avatar
  • Joined: Oct 30, 2004
  • Posts: 2521
  • Loc: /usr/src/MI
  • Status: Offline

Post January 14th, 2007, 3:11 pm

`abc\{3,5\}d`outputs abc{3,5}d to the console. it needs \{ so that it doesn't try to process the { instead.
where exactly did you get this concotion from? lol
Image
"In a world without walls and fences, who needs Windows and Gates?"
  • Don2007
  • Web Master
  • Web Master
  • No Avatar
  • Joined: Nov 21, 2006
  • Posts: 4924
  • Loc: NY
  • Status: Offline

Post January 14th, 2007, 3:43 pm

According to the man page the string abc would be matched at least 3 times but no more than 5. The \ is supported in egrep, not grep.
How do you know when a politician is lying? His mouth is moving.
  • marjeg
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Jan 14, 2007
  • Posts: 8
  • Status: Offline

Post January 15th, 2007, 12:57 am

AnarchY SI wrote:
`abc\{3,5\}d`outputs abc{3,5}d to the console. it needs \{ so that it doesn't try to process the { instead.
where exactly did you get this concotion from? lol


Hi there! Thanks a lot for yur answer! :D
I got it from some questions from a friend of mine...
Thanks again! /Maria
  • marjeg
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Jan 14, 2007
  • Posts: 8
  • Status: Offline

Post January 15th, 2007, 1:00 am

Don2007 wrote:
According to the man page the string abc would be matched at least 3 times but no more than 5. The \ is supported in egrep, not grep.


Thanks for your answer! :D
Now I can finally relax!
Thank you so much! :D
Maria
  • Don2007
  • Web Master
  • Web Master
  • No Avatar
  • Joined: Nov 21, 2006
  • Posts: 4924
  • Loc: NY
  • Status: Offline

Post January 15th, 2007, 5:35 pm

Don't tell me that you couldn't relax until you had the answer to that question. You get old fast that way.
How do you know when a politician is lying? His mouth is moving.
  • JackB
  • Born
  • Born
  • No Avatar
  • Joined: Jan 30, 2007
  • Posts: 2
  • Status: Offline

Post January 30th, 2007, 2:24 pm

Also try typing "man grep" (no quotes) in the terminal for more information on what it does.

Here's a good tutorial on grep and regular expressions:
http://pegasus.rutgers.edu/~elflord/unix/grep.html

Post Information

  • Total Posts in this topic: 10 posts
  • Users browsing this forum: No registered users and 113 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.