![]() |
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 |
| simple tcsh question using foreach | moldoverb | Shell Programming and Scripting | 1 | 01-07-2009 08:05 PM |
| foreach statement in ksh | asulli01 | UNIX for Dummies Questions & Answers | 8 | 11-26-2008 03:55 PM |
| foreach loop | abch624 | Shell Programming and Scripting | 1 | 03-19-2008 09:34 PM |
| foreach folder | eltinator | Shell Programming and Scripting | 7 | 08-13-2007 02:37 AM |
| foreach loop question | clipski | UNIX for Dummies Questions & Answers | 7 | 12-22-2005 01:28 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
foreach question
OK, so I am extremely rusty and am just getting back to Unix after 9 years.
I'm stuck on something easy. 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. 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! |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|