I have a multi line text file where each line has the format
..... Game #29832: ......
I want to append the character '1' to each number on each line (which is different on every line), does anyone know of a way to do this from the command line?
Thanks
sed -i -e 's/Game #[0-9]*/&1/' file
-i
is for in-place editing, and &
means whatever matched from the pattern. If you don't want to overwrite the file, omit the -i
flag.
Using sed
:
cat file | sed -e 's/\(Game #[0-9]*\)/\11/'
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