Click to See Complete Forum and Search --> : bash script


macian
10-17-2002, 02:20 PM
Hello,

I am trying to print a file and have it exclude line that contains certain text.

Like lets say I have the file called 'names' containing:

jim
fred
sam
jason
pat

if I did cat names | grep sam it would return the line sam is on.

What I want to do is have it return every line but the one that sam resides on.

I'm sure this is not too hard, and I have been looking for it this for quite a bit this morning, so please do not bother to post RTFM.

Thanks in advance

Sean D.

rbermejo
10-17-2002, 02:38 PM
Use the 'v' option

grep -v word file

:rolleyes: