Sed - Stream Editor in Unix
From Rizzo_Lab
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
Since all our home directories were moved to sbhome0 or sbhome1, you can painlessly fix your scripts to point to the correct home directory. -i uses in-place editing, so just test this on a few scripts first. For safety, make a backup of all your scripts before doing this. If you are on home2, replace [1,3] with [1,2]. We are replacing home1 as well because all our home directories were aliased to /home1 as well.
sed -i 's/home[1,3]/sbhome0/g' *.csh *.py