![]() |
|
|
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 |
| How to remove all matches in a string with sed | lumix | Shell Programming and Scripting | 0 | 12-14-2007 08:09 PM |
| creating folder when the string matches | maximas | Shell Programming and Scripting | 2 | 10-04-2007 08:24 AM |
| to create foder when the string matches | maximas | Shell Programming and Scripting | 1 | 09-28-2007 06:23 AM |
| Printing the following line that matches an string | jgarcia | Shell Programming and Scripting | 7 | 05-10-2007 02:31 AM |
| String in text matches folder name | shackman66 | Shell Programming and Scripting | 2 | 05-05-2004 06:46 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Looking for a string in files and reporting matches
Can someone please help me figure out what the command syntax I need to use is?
Here is what I am wanting to do. I have hundreds of thousands of files I need to look for a specific search string in. These files are spread across multiple subdirectories from one main directory. I would like to find a way to search through all these files, and everytime it sees a file with this specific search string in it, make a note of it in a log file. So, for instance, I have the directory /files/accounting/ Under /files/accounting, I have LOTS of Microsoft Excel files that I want to search for the specific string "\\cttrut04\dept\" and then everytime it finds a file by that name, dump it to a log file. I thought about something like: find /files/accounting/ -name "*xls" | more | grep -i "\\clttrut04\dept" > \log\filelog.txt This doesnt work. I am not sure how to do a find and then feed each file name it finds to more to search it and then grep it for the search string. Can anyone help with this? Thank you, Brian |
|
||||
|
Quote:
Also, why do you have four \\\\'s and two \\'s, when the search string is only \\ and \? Thanks for your help!!! |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|