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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.