SUMMARY: Using sed or awk to append a line based on some search criteria
From: Anwar Saadeh (saad_an_at_printronix.com)
Date: 07/30/03
- Previous message: Phillip Smith: "Summary: Solaris directory file size"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 30 Jul 2003 09:34:12 -0700 (PDT) To: sunmanagers@sunmanagers.org
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
- Previous message: Phillip Smith: "Summary: Solaris directory file size"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]