![]() |
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 |
| foreach loop | ROOZ | Shell Programming and Scripting | 3 | 06-05-2008 03:20 PM |
| foreach loop + 2 variables | JamesGoh | Shell Programming and Scripting | 3 | 06-04-2008 03:36 AM |
| using foreach loop | sam4now | Shell Programming and Scripting | 6 | 04-26-2008 11:22 AM |
| foreach loop | abch624 | Shell Programming and Scripting | 1 | 03-19-2008 09:34 PM |
| Foreach loop | haze21 | Shell Programming and Scripting | 4 | 11-16-2007 03:11 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
foreach loop question
Hello, I am new at this forum so please bare with me on this.
Within a given directory, I have a list of files in which in each file, I would like to do a substitution. I would like to substitute the string mlcl to mll in each file using the foreach command. I dont quite get how to do that. If you can provide help, it would surely be appreciated |
|
|||||
|
My above post was an interactive session, hence the "touch"es.
If you don't want to keep the changes, you can easily do (as long as there aren't a load of files....) Code:
ls *mlcl* | sed 's/mlcl/mll/g' Code:
ls | while read file; do
echo "${file}" | sed 's/mlcl/mll/'
done
Cheers ZB |
|
||||
|
why you have put sed command in ` quotes ?? i guess it is not required
foreach i ( * ) sed s/mlcl/mll/g end |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|