I have a file with this content:
foo: bar1 foo: bar2 foo: bar3 foo: bar4 foo: bar5
I want to remove the chains "foo: " so the file remains:
bar1 bar2 bar3 ...
I'm trying it with:
$ sed 's/foo: /' file.txt
but it says:
sed: -e expression #1, char 15: unterminated `s' command
Any help?
Javi
Alternatives to sed include the Unix utility awk , perl , and nearly any general purpose programming language.
$ sed -i '1d' filename. In the example, 1d essentially stands for first line deletion. Using a\ (“append”) can add lines to a file.
To delete a line, we'll use the sed “d” command. Note that you have to declare which line to delete. Otherwise, sed will delete all the lines.
You need to:
$ sed -r 's/^foo: //' file.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With