I have a file (foo.txt) containing the following:
some-text 0
I use the following sed-command to replace the 0 with a 1:
search_text="some-text";
sed "s/${search_text} 0/${search_text} 1/" -i foo.txt;
This results in foo.txt containing:
some-text 0
some-text 1
How can I get it to replace the found line instead of appending a new line?
It occurs with GNU sed version 4.2.1 on SL06.
If you like to try
awk
do you try
using group pattern instead of twice the search_text
which shell are you using (cause i see
;
likec
end of line not often used on several line in shell) ?