Sed Command Examples

Insert a newline in front of pattern

Example your text in the file is as below

Updated number of BobUpdated number of ChrisUpdated number of Peter

If you want format the text as below
Updated number of Bob
Updated number of Chris
Updated number of Peter


Need to use the command as below.

 [root@server ~]# sed 's/Update/\n&/g'  test.txt

Leave a Reply

Your email address will not be published. Required fields are marked *