[clug] Quick text-search question...

Peter Barker pbarker at barker.dropbear.id.au
Tue Nov 18 15:10:06 EST 2003


On Tue, 18 Nov 2003, Ian Perry wrote:

> This shouldn't be too hard for most of you, but it's causing me a bit of
> trouble; what I need to do is find only the instances of matching lines
> in a whole bunch of text. It's already sorted, so the matches are
> consecutive - if that helps.

To find "fred" in a file called "barney":

grep -F 'fred' barney

grep is capable of much more than matching simple strings. The -F makes
sure none of that gets in your way.

type "man grep" at a command prompt for more information.

> Ian

Yours,
-- 
Peter Barker                          |   N    _--_|\ /---- Barham, Vic
Programmer,Sysadmin,Geek              | W + E /     /\
pbarker at barker.dropbear.id.au         |   S   \_,--?_*<-- Canberra
You need a bigger hammer.             |             v    [35S, 149E]
"They'll need a whole new Orwellian pseudo-crime-name for that... I
 suggest "digital molestation of kittens". -  Jeremi (14640) from Slashdot




More information about the linux mailing list