Link to home
Start Free TrialLog in
Avatar of Rok2005
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?

cat DVR |
        while read x
                do
                        fgrep $x all1 >> foundDVR.out
 
done

Open in new window

Avatar of omarfarid
omarfarid
Flag of United Arab Emirates image

see -f you can use the -w option
Avatar of Tintin
Tintin

grep -w -f DVR all1 >foundDVR.out
ASKER CERTIFIED SOLUTION
Avatar of Rok2005
Rok2005

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial