![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| comparing the content of two directories | xyzt | UNIX for Dummies Questions & Answers | 2 | 04-29-2008 10:36 AM |
| searching files through all subdirectories beneath the current directory | milagros | Shell Programming and Scripting | 5 | 05-15-2007 04:00 PM |
| searching for content of files | Aretai | UNIX for Dummies Questions & Answers | 19 | 03-09-2007 06:44 AM |
| Searching for files over 30 days old in current directory | cxredd4 | Shell Programming and Scripting | 18 | 06-11-2006 02:16 AM |
| Searching and Removing File Content | rkumar28 | Shell Programming and Scripting | 7 | 02-27-2005 05:40 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
searching content of files in the current and sub directories
Hi
I was wondering why command 2 doesn't work like command 1 below. 1. find . -exec grep "test" '{}' \; -print 2. ls -R | grep "test" I am trying to search "test" from all the files in the current and sub directories. What's wrong with my command 2? Thanks in advance for your help |
|
||||
|
Quote:
Code:
ls -R | xargs grep "test" #this makes command 2 like command 1 |
|
||||
|
Hi shamrock
Thanks for your help However the code you suggested ls -R | xargs grep "test" gives me a huge list with ending "No such file or directory". i.e. grep: expr.sh: No such file or direcotory Is it possible to only display the directory and file name when the text that I am searching is found? Thanks |
|
||||
|
2>/dev/null
Hi,
For the "No such file or directory", it is becuase there are error messages print to the stand output, you can ignore them by adding Code:
2>/dev/null |
| Sponsored Links | ||
|
|