Difference between revisions of "Unix helpers"

From Blue-IT.org Wiki

m
Line 1: Line 1:
 
==sed==
 
==sed==
 +
Mostly perfect:
 +
* [http://sed.sourceforge.net/sed1line.txt sed1line.txt]
 +
 
Add a line into a given script
 
Add a line into a given script
 
  sed -i '/"Text in the line before"/s@"Text in the line before"@&\n\tNEW_TEXT_IN_LINES_AFTER@' \
 
  sed -i '/"Text in the line before"/s@"Text in the line before"@&\n\tNEW_TEXT_IN_LINES_AFTER@' \

Revision as of 15:51, 20 February 2012

sed

Mostly perfect:

Add a line into a given script

sed -i '/"Text in the line before"/s@"Text in the line before"@&\n\tNEW_TEXT_IN_LINES_AFTER@' \
/etc/yourscript