-   Linux - Newbie (
-   -   find command (

muralimunna 04-17-2012 07:46 AM

find command
how can get only 2.1G,using sed and awk commands
/dev/ad0s1d 5.8G 2.1G 3.2G 4

fukawi1 04-17-2012 07:48 AM

To find a thing IN as in INSIDE a file? you dont with find.
You use grep.

grep "something" /somewhere/somefile
man grep for more information.

David the H. 04-17-2012 08:55 AM

As said, find is for locating files based on conditions like filename and modification date, while grep is for searching inside them (assuming text files).

Here are a couple of links about using find:

You can, of course, combine them in order to locate files and then search inside them. But you should first see if you can use grep's own built-in recursive file-matching ability. Read the "info grep" page for details on how to use it.

Satyaveer Arya 04-17-2012 10:50 AM


Welcome to LQ!
First you need to check the man page of find and grep.

# man find
# man grep

And I think you can understand the difference between find and grep already told by fukawi1 and David the H. :)

pafoo 04-17-2012 11:41 AM

To help a bit more you can use find to locate files then grep for a particular item in them.


find /home/bobby -type f -name "*.txt" -exec grep "funny joke" {} \;

All times are GMT -5. The time now is 04:19 AM.