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

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

Thank you all:

Bertrand Hutin and 

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.

sunmanagers mailing list
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