Results 1 to 3 of 3
Here's a sample command...
cat filetosearch.txt | fgrep -is -f matchlist.txt
Obviously the normal behavior is to output the matched lines from
the filetosearch.txt data file. What if my goal ...
- 08-14-2008 #1Banned
- Join Date
- Dec 2002
- Location
- Texas
- Posts
- 242
Can grep output source of a match?
Here's a sample command...
cat filetosearch.txt | fgrep -is -f matchlist.txt
Obviously the normal behavior is to output the matched lines from
the filetosearch.txt data file. What if my goal was just to find out
which lines from the matchlist.txt list it was able to find?
For instance...
I don't care that "1000 Smith Street #1234" in filetosearch was found.
But I *do* care to know that "Smith Street" from matchlist was found.
Is there a way to do this? Obviously I could loop through the matchlist
and do a single instance grep against the data file, but that is a bunch
of work that seems unnecessary. Unless there's no easy way?
Thanks!
- 08-14-2008 #2Linux Newbie
- Join Date
- Jul 2008
- Posts
- 181
grep -o (Stupid requirement to post at least ten characters).
- 08-14-2008 #3Banned
- Join Date
- Dec 2002
- Location
- Texas
- Posts
- 242


Reply With Quote
