SED add delete replace
Tags:
SED add/ delete/ replace ------------------------ sed -f <scriptname> <filename> # runs the scripted commands against the <filename> example: sed -f deletescript myfile.ldif sed -f addscript newfile.ldif or from command line: sed '/<searchstring>/d' filename ----------------------------------------------------------------------------------- ----------------------------------------------------------------------------------- deletescript: # deletes any line containing <searchstring> /<searchstring>/d ------------------------------------------------------------------------------------ addscript: # adds the <newline entry> above any line containing <searchstring> /<searchstring>/i\ <newline entry> ------------------------------------------------------------------------------------ addscript: # adds the <newline entry> beneath any line containing <searchstring> /<searchstring>/a\ <newline entry> ------------------------------------------------------------------------------------ replacescript: # replaces the <searchstring> with the <newline entry> /<searchstring>/c\ <newline entry> ------------------------------------------------------------------------------------ change every lowercase a, b and c to uppercase sed 'y/abc/ABC/' filename ------------------------------------------------------------------------------------ Change every instance of <string> with <newstring> sed 's/string/newstring/g' filename ------------------------------------------------------------------------------------
»
- Add new comment
- 3880 reads
