SUMMARY: Using sed or awk to append a line based on some search criteria

From: Anwar Saadeh <saad_an_at_printronix.com>
Date: Wed Jul 30 2003 - 12:34:12 EDT
My apology since this was not related to Sun system administration. 

Thank you all:

JULIAN, JOHN C 
Bertrand Hutin and 
ttg



Here are the answers:

-----From JULIAN------------------

sed "/$MatchStuff/a\\
$NewLineStuff"  OrigFile > NewFile


-----From Bertand------------------

awk '/specific text/{print;print "appended line";next+;{print}' file




My original question:

Hi Sun Managers,

I need to be able to search for a specific text in a file and append a new line 
right after the text I found.

I know there was something about using "\a" for appending but for some reason I 
cannot get it work.

TIA
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Wed Jul 30 12:37:54 2003

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:17 EST