My learning notes for R, Unix, Perl, statistics, tools/resources, biology etc. everything about Bioinformatics
To replace a word in a file, use
perl -pi -e 's/abc/def/;' xyz
or
sed -e 's/abc/def/;' xyz > xyz_new
To make the replacement in place, use sed -i filename. then the file will be replaced after the command.
sed -e 's/abc/def/;' -i xyz
No comments:
Post a Comment