![]() |
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 |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Recursive FTP -- here at last. | Perderabo | Shell Programming and Scripting | 52 | 03-25-2009 12:15 PM |
| recursive grep issue | Mace | UNIX for Dummies Questions & Answers | 1 | 08-11-2006 07:39 AM |
| recursive GREP ? | alan | UNIX for Dummies Questions & Answers | 3 | 08-22-2003 03:15 AM |
| grep recursive directories | jagannatha | UNIX for Dummies Questions & Answers | 8 | 07-24-2003 04:00 PM |
| Recursive FTP | aslamg | UNIX for Dummies Questions & Answers | 1 | 03-08-2001 04:27 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Recursive grep
Hello,
First time post - I have no formal unix training and could use some help with this. I have a list of strings in File1 that I want to use to do a recursive search (grep) under a specific directory. Here is an example of the string I need to search: /directory/dire ctory/directory/dire ctory/filename I'm trying to illustrate that the string is a full directory path of a file where some of the directories have spaces in their names. I then have the following script: for h in `cat file1`; do grep -rl "$h" /../../../../../ >> /../../file2 ; done So, I'm trying to say for each string in file1, do a recursive grep in the specified directory and print the results to file2. The problem (I think) I'm running into is the format of the string I'm searching, the cat I'm doing is treating the spaces as escapes which throws the grep off. I've tried putting the string in single and double quotes but it's still not working. Sorry for the lack of technical terminology - I hope I was clear enough. If anyone can offer any help on making it work with what I have or a simpler alternative to what I have, it would be a great help. Thanks - upstate boy |
| Bookmarks |
| Tags |
| grep, grep recursive, recursive grep |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|