narrowing down a file
Posted on 2011-03-07
I have two files.
File1.txt is tab-separated and contains several fields.
File2.txt contains just one field.
I want to get a subset of file 1, such that field 3 of it matches exactly(1) one of the lines in File2.txt.
The match has to be complete, not partial (so if one says foxnews.com/blah.html and the other says foxnews.com or vice versa - that would not be a match). Otherwise, I could have just done grep –F –f File2.txt File1.txt.
How would I do that in a shell script?