|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#1
|
|||
|
|||
|
Need help with sed
Hello all,
I need a sed command to replace a pattern with a variable part. e.g. replace the following lines: value=1 value=2 value=3 with value=1 id=1 value=2 id=2 value=3 id=3 Can you please tell me how to do it with sed or awk ? Thank you |
|
#2
|
||||
|
||||
|
sed -e "s/value=1/value=1 id=1/ig" filename > filename.out
__________________
Up the Irons What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest Down with Sharon Osbourne Puzzle of the Month solved by sizeablegrin, etienne141 and L7Sqr, superior C/C++ programmers of the month |
|
#3
|
|||
|
|||
|
Thank you Scorpions4ever,
When I tried your code, I got the following: value=1 id=1 value=2 value=3 I think some $ variable needs to be added, but I am not sure where |
|
#4
|
||||
|
||||
|
Heh I figured you could run it four times, once with each string to replace. It is possible to do it as one regexp -- I did it too, but I'd rather you post your attempt before I help you with it.
|
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Need help with sed |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|