trying to use find and grep, but don't know well enough.
hi
i am trying to use find and grep to find out all occurrences of a particular ip address in any of my files. i am using find * /| grep xx.xxx.xx.xx and i cannot get any files. can somebody ehlp me with the right syntax ? |
well the usage for grep is
grep <switches> <pattern> <file list> to find a string in a set of files I use grep -H <pattern> <file list> I think you use find where <file list> is not really sure though you should check the man page for the rest of the switches for grep. |
Quote:
|
this one doesn't seem to work
i tried using grep with -H as well as -r option. doesn't seem to work.
|
well, what do you get, vs. what do you want to get?
Code:
grep -r xx.xxx.xx.xx / |
i am not getting nothing. basically i just want to find all files that contain an occurrence of a particular ip address.
just as in windows, as we search all files and folder, including system and hidden, for text containing duhduhdude, we may get for example file idiots.txt which contains a text saying "the first idiot is duhduhdude, we are yet to find more" so that i can go to idiots.txt and edit it. |
Quote:
1. you're syntax is wrong. double check your syntax 2. you don't have permissions for the files 3. no file exists with the ips. One way to check this would be to search for something obvious, like: grep -r a / which would search for 'a' in all files. after you get some results to show the command actually works, press ctrl-c to stop it. If this worked, but the previous did not, no files exist with your ip. maybe create a temp file with the ip, and search again. This time, you should atleast get this one result. |
i created a file duh.txt on the root folder with that particular ip "xxx.xx.xx.xx"
grep -r xxx.xx.xx.xx / did not yield me any result :( did not even show me that file. |
ok, let's try one last thing.
create a file with the ip address in your home dir. then, do: grep -r "xxx.xx.xx.xx" ~/* if this works, it may be that it was b/c of permission problems or the use of quotes in the expression. if not, maybe you're grep is messed up. :( |
thanks so much, that worked.
|
All times are GMT -5. The time now is 08:18 AM. |