Difference between revisions of "Unix helpers"

From Blue-IT.org Wiki

(sed)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
==sed==
 
==sed==
 +
Mostly perfect:
 +
* [http://sed.sourceforge.net/sed1line.txt sed1line.txt@sed.sourceforge.net]
 +
 
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@' \
 
  /etc/yourscript
 
  /etc/yourscript
 +
 +
[[Category:Scripting]]

Latest revision as of 15:52, 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