![]() |
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 |
| Search, replace string in file1 with string from (lookup table) file2? | gstuart | Shell Programming and Scripting | 9 | 06-08-2009 06:11 AM |
| replace string in XML with sed | chiru_h | Shell Programming and Scripting | 6 | 04-09-2008 07:49 PM |
| replace string | sam99 | Shell Programming and Scripting | 4 | 03-04-2008 01:39 AM |
| replace a string | melanie_pfefer | Shell Programming and Scripting | 11 | 01-17-2008 10:57 AM |
| Replace string B depending on occurence of string A | hemangjani | Shell Programming and Scripting | 1 | 12-05-2006 05:10 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Is it possible to replace more the 1 string with one SED?
i want to replace two phrases in text file
originalstringA.1. blah blah.... originalstringB.1. got this code so far: #variables IP=$1 NO=$2 FS=$3 IS=$4 NN=1 #echo variables echo '' echo $IP echo $NO echo $FS echo $IS echo '****' echo $NN #generate files and configure while [ $NN -le $NO ] do cp template.egsinp $IP.$NN.egsinp sed s/template/$IP.$NN/ <template.egsinp > $IP.$NN.egsinp #i need something else here that replaces something else and has the same input/output files as the above sed. echo '****' NN=$(($NN + 1)) echo $NN done #exit exit |
|
||||
|
You can replace as many strings as you like with a single sed command by using this syntax:
Code:
sed -e "s/a/b/" -e "s/c/d/" ... |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| sed |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|