Monday, March 3, 2008

Basic reminder about Sed command

(Small thing you always know, but always forget)

if you have a file "pp.txt" with the following text:
GGATSGSFFSTSTYYSGHGSSYSHSUSUSH
in order to substitute a "Y" for a "P", the command should be:
sed s/Y/P/g < ppp.txt
the substituted string will go to the standard output. I you wish, you can redirect it to a file:
sed s/Y/P/g < ppp.txt > new_ppp.txt

No comments: