The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 07-11-2006
Hitori's Avatar
Hitori Hitori is offline Forum Advisor  
Registered User
  
 

Join Date: Jun 2006
Posts: 360
Try sed with i (insert command):
$ cat file | sed -e '/TEXT/ i COMMENT'

$ cat logfile
Ex : LINE 1 xxxxx
LINE 2 xxxx CALL xxxx
LINE 3 xxxx PERFORM UNTIL
$ cat logfile | sed -e '/CALL/ i COMMENT'
Ex : LINE 1 xxxxx
COMMENT
LINE 2 xxxx CALL xxxx
LINE 3 xxxx PERFORM UNTIL