How can I insert gaps at certain places in a text file using shell script? For example, I want to insert enter after word "complete" wherever it is found in a text file.
One of the possibilities is using sed
:
sed 's/complete/complete\n/g' filename
To replace the content of the file directly, use sed -i...
.
To backup the original file with a .bak
extension, use sed -i.bak...
.
In order to provide a more precise answer, your question should be more accurate.
-
This, just like this one and this one, will only work with
gnu sed
. – don_crissti Oct 19 '16 at 12:46