find and replace from command line unix find and replace from command line unix unix unix

find and replace from command line unix


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/'


sed 's/ Game #\([0-9]*\):/ Game #1\1:/' yourfile.txt