If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > linux command help

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-15-06, 02:55
jagans jagans is offline
Registered User
 
Join Date: Jul 2004
Posts: 48
linux command help

hello..
anyone know the command for searching files with its content
for eg i want to list all the files with content 'test'

thnks
Jagans
Reply With Quote
  #2 (permalink)  
Old 04-17-06, 12:27
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
Cool


man grep
__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
Reply With Quote
  #3 (permalink)  
Old 05-17-06, 05:44
uday123 uday123 is offline
Registered User
 
Join Date: May 2006
Posts: 4
solution

if u want to search a word in your system then use the following command.
customize it as per your requirement.
find / -type f|xargs grep "word"
Reply With Quote
  #4 (permalink)  
Old 05-17-06, 08:23
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
Cool


No need to use 'find', If you would have checked the manual for the grep command (man grep) you would have noticed it provides you with an answer:

grep 'test' MyFile*



__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
Reply With Quote
  #5 (permalink)  
Old 05-17-06, 09:32
pdreyer pdreyer is offline
Registered User
 
Join Date: May 2005
Location: South Africa
Posts: 1,268
Quote:
Originally Posted by LKBrwn_DBA
No need to use 'find'
Yes generally that is true, but watch out for FIFO special files.
If you don't use find with -type f
you may think your command is hanging.
Reply With Quote
  #6 (permalink)  
Old 05-17-06, 11:57
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
Cool

Quote:
Originally Posted by pdreyer
Yes generally that is true, but watch out for FIFO special files.
If you don't use find with -type f
you may think your command is hanging.
Yes, but normally a savy Unix user would not locate such files on the same directory as regular files, but otherwise either on /tmp or other special directory.

__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On