[KLUG Members] Re: grep, egrep, fgrep

Robert G. Brown members@kalamazoolinux.org
Thu, 06 May 2004 10:55:14 -0400


On Thu, 06 May 2004 10:32:12 -0400, Peter Buxton wrote:

>> > Should I still be escaping the period somehow anyway?
>
>If you want to eliminate false positives, which may be important,
>depending on what you're doing with the info so gathered.
>> IMO, yes. I do it with success:  ls -l |grep \.s

>ls -l | grep \\.s
>Or the shell throws away your single backslash. Or use '\.s'.

Ah yes, my mistake. I tend to use \\.s. Thanks for the correction.

On Thu, 06 May 2004 10:31:25 -0400, Adam Tauno Williams wrote:

>> Can anyone explain why there are still three different greps?
>Because geeks are a ornery, contrary, and short-sighted lot?
Almost as good a reason as any! :)

>> One of my associates says that they each were written for a purpose but
>> supposedly their functionality should all be combined into just plain
>> grep now.
>
>And they would call that bgrep, for "bloated grep". :) 
Or maybe not... depends on your idea of "bloat", and how much resuse there is.
For this sort of thing, there's probably a lot of reuse.

>Sorry, just getting warmed up for my .Net presentation on Tuesday.
Apology accepted! :)

>But anyway, take a look....
>[awilliam@estate2 awilliam]$ ls -l /bin/grep
>-rwxr-xr-x  1 root root 77208 Jan  5 10:15 /bin/grep
>[awilliam@estate2 awilliam]$ ls -l /bin/egrep
>lrwxrwxrwx  1 root root 4 May  3 20:16 /bin/egrep -> grep
>[awilliam@estate2 awilliam]$ ls -l /bin/fgrep
>lrwxrwxrwx  1 root root 4 May  3 20:16 /bin/fgrep -> grep
>And one grep it is.
Yes. It ought to be pointed out that this has taken place in the GNU/GPL unix 
world, not nessesarily by all the commerical unix vendors.

>> The reason I ask is I often need to search for filenames with a period
>> in my pattern, like '.s' , for filenames like file.sam using a comand
>ls | grep \\.s
Yes, thanks to Adam as well for correcting my typo.

							Regards,
							---> RGB <---