![]() |
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 |
| Read text file from a specified string to the end | bsrajirs | UNIX for Advanced & Expert Users | 9 | 01-11-2008 01:05 AM |
| String search - Command to find second occurance | saurabhsinha23 | UNIX for Dummies Questions & Answers | 5 | 12-06-2007 08:03 PM |
| generate new string from a text file | walterwaston | Shell Programming and Scripting | 6 | 10-16-2007 03:43 PM |
| appending string to text file based on search string | malaymaru | Shell Programming and Scripting | 1 | 06-09-2006 08:53 AM |
| How to input username on text file into finger command on shell script | Micz | Shell Programming and Scripting | 3 | 11-08-2005 02:38 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Looking for command(s)/ script to find a text string within a file
I need to search through all files with different file suffixes in a directory structure to locate any files containing a specific string
|
|
||||
|
Thanks to both of you
These examples helped. Thank you.
I do not use shell scripting much. Now I can learn from these results. The results were : Code:
devr> find . -name '*.*' -exec grep -ilw 'MAXCOMB' {} \;
./IPY0115.prog
./IPY0130.pl
./condir_and_copy_daily.sh
./IPY0130_old.pl
devr> find . -name '*.*' -exec grep -ilw 'maxcomb' {} \;
./IPY0115.prog
./IPY0130.pl
./condir_and_copy_daily.sh
./IPY0130_old.pl
devr>
devr> | xargs grep -il 'maxcomb' {} \; <
grep: can't open {}
grep: can't open ;
grep: can't open {}
grep: can't open ;
./IPY0115.prog
grep: can't open {}
grep: can't open ;
grep: can't open {}
grep: can't open ;
grep: can't open {}
grep: can't open ;
grep: can't open {}
grep: can't open ;
grep: can't open {}
grep: can't open ;
grep: can't open {}
grep: can't open ;
./IPY0130.pl
grep: can't open {}
grep: can't open ;
grep: can't open {}
grep: can't open ;
./test_file_shell.sh
grep: can't open {}
grep: can't open ;
./dir_copy_daily_files.sh
./dir_copy_biweekly_files.sh
./condir_and_copy_biweekly.sh
./condir_and_copy_daily.sh
grep: can't open {}
grep: can't open ;
grep: can't open {}
grep: can't open ;
./doi_dnld_files.prog
./IPY0130_old.pl
grep: can't open ./View
grep: can't open for
grep: can't open value_set
grep: can't open Role_id.sql
devr> rgs grep -il 'maxcomb' <
./IPY0115.prog
./IPY0130.pl
./test_file_shell.sh
./dir_copy_daily_files.sh
./dir_copy_biweekly_files.sh
./condir_and_copy_biweekly.sh
./condir_and_copy_daily.sh
./doi_dnld_files.prog
./IPY0130_old.pl
grep: can't open ./View
grep: can't open for
grep: can't open value_set
grep: can't open Role_id.sql
devr> find . -name '*.*' -print | xargs grep -ilw 'maxcomb'
./IPY0115.prog
./IPY0130.pl
./condir_and_copy_daily.sh
./IPY0130_old.pl
grep: can't open ./View
grep: can't open for
grep: can't open value_set
grep: can't open Role_id.sql
|
|
||||
|
Quote:
why is that ? find with xargs grep that would do.. If you dont want to display the output - that files cant be opened then use 2>/dev/null with find |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|