[KLUG Members] Re: Re: grep, egrep, fgrep

MPs members@kalamazoolinux.org
Thu, 6 May 2004 15:49:37 -0400 (EDT)


On Thu, 6 May 2004, John Pesce wrote:

> My other question was about grepping for multiple items, like cat or dog
> 
> Adam suggested grep -F "cat\ndog"
> 
> Does the \n mean anything? Will it match if they are on the same line?
>

I think the \n should shell out as a "carriage return", equivalent to 
pressing the enter key. Could this have come from the conversation branch 
about finding one thing split over different lines of the file? [ala 
fgrep, I think?]

 
> More searching turned up something like:
> 
> egrep 'cat|dog' file
> 
> which seems to work. Is this the same command internally?
> 
>  
This is what I was going to suggest [egrep = "expression" grep, or regex 
grep. In my mind at least].

--MilesP