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

From: Anwar Saadeh (saad_an@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



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:26:49 EDT