grep search
To recursively search for a string in Linux
grep -ir searchstring *
To match exact search string
grep -w searchstring *
Ex:
line1: 192.168.80.14
line2: 192.168.80.141
grep 192.168.80.14 * will return both lines
grep -w 192.168.80.14 * will return only first line
To limit no. of grep results
grep searchstring * -m 1
Ex:
line1: 192.168.80.14
line2: 192.168.80.141
grep 192.168.80.14 * will return both lines
grep 192.168.80.14 * -m1 will return only one line
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home