I use the ack tool to find string or IP address in file system
but please see the follwoing
why ack not find the IP = 10.45.45.130 under /etc/sysconfig/*
the IP = 1:10.45.45.130 exist under network dir in uoo file
lidia
./ack -r 10.45.45.130 /etc/sysconfig/*
./ack -r 10.45.45.130 /etc/sysconfig/network/*
/etc/sysconfig/network/uoo
1:10.45.45.130
example of uoo file
more /etc/sysconfig/network/uoo
10.45.45.130
Answer
Did you try 'ack -a
'?
From BetterThanGrep,
-a, --all-types All file types searched;
Option -r
is not required (afaik) default behavior is recursive.
To turn off recursion you use the '-n
' option.
Now, to check if the '-a
' is going to help you,
Try your command with the '-l
' option (instead of the '-r
' option).
Then try it again with the '-L
' option.
You will figure what is going on based on where the 'uoo
' file shows up in your search results.
Here is what happens,
-l, --files-with-matches
Only print filenames containing matches
-L, --files-without-matches
Only print filenames with no matches
So, if your file does not show up on either of these forms, you need to add in the '-a
' option
(ack
is more powerful than grep
but its also a bit tricky).
No comments:
Post a Comment