Usage Of Sed
2018-04-02
Typical usage
sed SCRIPT INPUTFILE... > OUTPUTFILE
note:if INPUTFILE==OUTPUFILE must call sed with option -i
.
note:default INPUTFILE is stdin,default OUTPUTFILE is stdout.
Characters substitution
sed "3,5s/pattern/object/1" inputfile > outputfile
:replace the first matched characters in 3-5th lines bypattern
withobject
.sed "s/pattern/object/3g" inputfile > outputfile
:replace the 3-infinite matched characters in each line bypattern
withobject
.