Sed - Stream Editor in Unix

From Rizzo_Lab
Revision as of 16:24, 31 May 2008 by WikiSysop (talk | contribs)
(diff) ←Older revision | view current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

Use a matched string in the replace section. The command below will save the matched string between HETATM and NVP as \1. We can then print the matched string between "ATOM " and NVR.

sed 's/HETATM\(.*\)NVP/ATOM  \1NVR/' nvp.pdb

Remove first line of a file

sed '1d' filename > newfile

References

  1. http://www.cs.hmc.edu/qref/sed.html
  2. http://sed.sourceforge.net/sed1line.txt