[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: awk or sed?



On Tue, 7 Apr 1998, George Bonser wrote:

> Hehe, try grep!
> 
> grep -vFf file2 file1
> 
> should do it.

For newbies:

The original poster wants to filter file1 using file2. The output should
contain everything in the input that is NOT matched by the pattern. That
means we are going to need a v option to grep.  Now, the pattern is a list
of items separated by newlines so we are going to need to tell grep this
with the F option. Finally, the pattern is contained in a file. We tell
grep the name of that file with the f option followed immediately with the
filename so:

grep -vFf <pattern-file> <input file>

means:

tell me everything that DOES NOT match what is in the newline delimited
file <pattern-file> contained in <input-file>



George Bonser 
Just be thankful that Open Group does not own Linux.
http://www.debian.org
Debian/GNU Linux ... the maintainable operating system.


--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: