![]() |
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 |
| Simple Question | stepnkev | Shell Programming and Scripting | 1 | 04-26-2007 03:17 PM |
| Simple C question... Hopefully it's simple | Xeed | High Level Programming | 6 | 12-15-2006 02:29 PM |
| Simple question. | TARFU | Shell Programming and Scripting | 2 | 01-27-2006 05:49 PM |
| foreach loop question | clipski | UNIX for Dummies Questions & Answers | 7 | 12-22-2005 01:28 PM |
| Ok simple question for simple knowledge... | Corrail | UNIX for Dummies Questions & Answers | 1 | 11-28-2005 01:03 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
using foreach with while loop
I want to search line-by-line for a string in a file, and I want to do this to a series of files in a directory. I'm doing this in tcsh
This works fine to do the search: while read i; do grep $i file2; done <file1.txt This also works fine to read a directory: foreach file ('/bin/ls *.txt') echo $file end but if I try and combine the two, no joy. foreach file ('/bin/ls *.txt') while read i; do grep $i file2; done <$file end Help please! Last edited by moldoverb; 01-07-2009 at 03:35 PM.. |
| Bookmarks |
| Tags |
| foreach, tcsh, while loop |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|