LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-17-2012, 07:46 AM   #1
muralimunna
LQ Newbie
 
Registered: Apr 2012
Posts: 4

Rep: Reputation: Disabled
find command


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

Last edited by muralimunna; 05-02-2012 at 03:20 AM.
 
Old 04-17-2012, 07:48 AM   #2
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 190Reputation: 190
To find a thing IN as in INSIDE a file? you dont with find.
You use grep.
Code:
grep "something" /somewhere/somefile
man grep for more information.
 
Old 04-17-2012, 08:55 AM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958
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:
http://mywiki.wooledge.org/UsingFind
http://www.grymoire.com/Unix/Find.html

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.
 
Old 04-17-2012, 10:50 AM   #4
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,415

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
muralimunna,

Welcome to LQ!
First you need to check the man page of find and grep.
Code:
# man find
# man grep
And I think you can understand the difference between find and grep already told by fukawi1 and David the H.

Last edited by Satyaveer Arya; 04-17-2012 at 10:51 AM.
 
Old 04-17-2012, 11:41 AM   #5
pafoo
Member
 
Registered: Jul 2011
Location: Alabama
Distribution: Red Hat/Ubuntu/Solaris
Posts: 37

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

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Find a file in directories without using find command sikanders Linux - Newbie 14 08-06-2010 09:47 PM
Find/grep/wc command to find matching files, print filename and word count dbasch Linux - Newbie 10 09-14-2009 06:55 PM
Single find command to find multiple files? thok Linux - Newbie 7 01-31-2009 05:45 PM
Using a single "Find" Command to find files bases on multiple criteria roboxooo Linux - Newbie 6 01-15-2009 05:13 AM
can't find my find command! how to replace? dave247 Debian 4 11-19-2008 11:51 AM


All times are GMT -5. The time now is 01:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration