lma
|
2010-09-28
, 09:17
|
Posts: 2,802 |
Thanked: 4,491 times |
Joined on Nov 2007
|
#11
|
|
2010-09-28
, 09:17
|
Posts: 1,751 |
Thanked: 844 times |
Joined on Feb 2010
@ Sweden
|
#12
|
The Following 4 Users Say Thank You to AlMehdi For This Useful Post: | ||
|
2010-09-28
, 09:42
|
|
Posts: 122 |
Thanked: 22 times |
Joined on Jun 2010
@ China
|
#13
|
"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.
If you know the file you are looking for is in "/home" and that it starts with "xou" you could write:Code:find <path to look in> | grep <word to look for>
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/.Code:find /home/ | grep "xou"
/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: | ||
|
2010-09-28
, 09:56
|
Posts: 1,751 |
Thanked: 844 times |
Joined on Feb 2010
@ Sweden
|
#14
|
|
2010-09-28
, 09:56
|
|
Posts: 122 |
Thanked: 22 times |
Joined on Jun 2010
@ China
|
#15
|
/home/user # time find . | grep ".*\.py$" | wc real 0m 0.91s user 0m 0.12s sys 0m 0.45s 95 95 5352 /home/user # time find . -name "*.py" | wc real 0m 0.64s user 0m 0.10s sys 0m 0.46s 95 95 5352 /home/user #
|
2010-09-28
, 10:05
|
|
Posts: 122 |
Thanked: 22 times |
Joined on Jun 2010
@ China
|
#16
|
|
2010-09-28
, 10:08
|
Posts: 1,751 |
Thanked: 844 times |
Joined on Feb 2010
@ Sweden
|
#17
|
Quick lookup in the manual and I found the way:
Code:/home/user # time find . | grep ".*\.py$" | wc real 0m 0.91s user 0m 0.12s sys 0m 0.45s 95 95 5352 /home/user # time find . -name "*.py" | wc real 0m 0.64s user 0m 0.10s sys 0m 0.46s 95 95 5352 /home/user #
|
2010-09-28
, 10:09
|
Posts: 3,617 |
Thanked: 2,412 times |
Joined on Nov 2009
@ Cambridge, UK
|
#18
|
|
2010-09-28
, 10:24
|
|
Posts: 122 |
Thanked: 22 times |
Joined on Jun 2010
@ China
|
#19
|
|
2010-09-28
, 11:03
|
Posts: 2,802 |
Thanked: 4,491 times |
Joined on Nov 2007
|
#20
|
remember.. this should be noob friendly. "find -name" is normaly better in a script
but "grep" is useful in more instances than just find.
The Following User Says Thank You to lma For This Useful Post: | ||