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:dogsomeoneAfter the manipulation, our file should looks like this:dogd0gsomeones0me0neHow this can be done with GNU tools like sed or awk?
Replace o with 0 in large wordlist and save the original word?
text processing;sed;awk
You can use sed:sed -i -e 'p' -e 's/o/0/g' fileExplanation:-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:awk '1;gsub(o, 0)' file >new_file