|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Hi All,
Does somone knows how can i replace entire line with sed command? for exmple: i have afile a=1 b=2 c=3 i need to find the "b" sring and then to replace the whole line "b=2" with "ghost". Thanks, |
|
#2
|
|||
|
|||
|
sed 's/b=2/ghost/' filename
You need to pu the output in a tem variable/file, if you use sed version 4 (or higher) you can use the -i option to put the output in the input file (like -o with sort: sort somefile -o somefile). Sed 4+ example: sed -i 's/b=2/ghost' filename Hope this helps. |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > SED command |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|