The -o option is for showing only the part which matched.
egrep -o o5 kk
Maybe you also want the -w option which avoids partial matches (like the pattern "dog" matches "endogenous").
Incidentally, notice that egrep accepts a file name argument; it doesn't need help from the cat to open and read a file. (This is called a "useless use of cat".)
It's not allowed to bump up questions! Please read the rules.
Do you get errors? Don't you get the desired output? Edit and play around with the given example, try to understand how it works and how to get the desired output.
Some commands have an option to use a temporary file behind your back, and replace the original file with the temporary file if the command is successful, but awk is not among those commands. Your sed might or might not have an -i option; Perl also has it (all modern versions and ancient ones too, as far back as I remember).
The ~ argument to -i says to save the original file in file~ with a tilde appended, just so you can rescue it if things go wrong. If you don't want a backup, just remove the tilde from the command line.
[quote=era;302230635]
Some commands have an option to use a temporary file behind your back, and replace the original file with the temporary file if the command is successful, but awk is not among those commands. Your sed might or might not have an -i option; Perl also has it (all modern versions and ancient ones too, as far back as I remember).