Rok2005
asked on
Unix FGREP Loop
I have a list of specific IPS. I'm trying fgrep lines containing those ips out a huge file.
The problem that i'm running into is that if i fgrep ips in the following format:
10.130.125.10 or 10.130.125.20
I will fgrep un-desired ips like 10.130.125.105... when i really want 10.130.125.10
QUESTION:
How can i set my code to fgrep specific ips even if some of the ip address exist in other ips?
The problem that i'm running into is that if i fgrep ips in the following format:
10.130.125.10 or 10.130.125.20
I will fgrep un-desired ips like 10.130.125.105... when i really want 10.130.125.10
QUESTION:
How can i set my code to fgrep specific ips even if some of the ip address exist in other ips?
cat DVR |
while read x
do
fgrep $x all1 >> foundDVR.out
done
see -f you can use the -w option
grep -w -f DVR all1 >foundDVR.out
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.