View Single Post
jukzh's Avatar
Posts: 122 | Thanked: 22 times | Joined on Jun 2010 @ China
#13
Originally Posted by AlMehdi View Post
"grep" is used to find a string from an output of a command.. when you only write "find /" it will output all the files on the n900. Which is not that useful. But if you add grep to find so it becomes "find / | grep <name>". Then "find" will only output the words that equals the one in grep.
Code:
find <path to look in> | grep <word to look for>
If you know the file you are looking for is in "/home" and that it starts with "xou" you could write:
Code:
find /home/ | grep "xou"
It will then give an out put on all the files and directories with "xou" in it. In this case it would find all the cases of xournal in /home/.
Note, it's not exactly the same thing.
Code:
/home/user # time find . -name "*.py" | wc
real	0m 0.63s
user	0m 0.11s
sys	0m 0.46s
       95        95      5352
/home/user # time find . | grep "*.py" | wc 
real	0m 0.87s
user	0m 0.12sa
sys	0m 0.45s
        0         0         0
/home/user #
 

The Following User Says Thank You to jukzh For This Useful Post: