I have a large text file with words. Every word is on a single line (typical wordlist).
I want to replace all characters "o" with the number "0" in every word, and the new formed word to be pasted on the next line after the original word.
For example, if we have this two in the list:
dog
someone
After the manipulation, our file should looks like this:
dog
d0g
someone
s0me0ne
How this can be done with GNU tools like sed
or awk
?
Best Answer
You can use
sed
:Explanation:
-i
: activates in-place editing of the file-e 'p'
: just pastes the line-e 's/o/0/g'
: replaces o with 0 and pastes the altered lineAnd if you want an
awk
solution: