Softwares |
Main /
Sed-stream-editorMain.Sed-stream-editor HistoryHide minor edits - Show changes to output Added lines 8-9:
(:table border=1 width=50% bgcolor=yellow cellspacing=0 :) (:cellnr:) Changed lines 13-14 from:
to:
(:tableend:) Added lines 17-18:
(:table border=1 width=50% bgcolor=yellow cellspacing=0 :) (:cellnr:) Changed lines 22-25 from:
to:
(:tableend:) Added lines 29-30:
(:table border=1 width=50% bgcolor=yellow cellspacing=0 :) (:cellnr:) Deleted line 35:
Changed lines 37-38 from:
to:
(:tableend:) Added lines 45-48:
*To delete any line containing the word "yourword" from the file "yourfile": (:table border=1 width=50% bgcolor=yellow cellspacing=0 :) (:cellnr:) Deleted lines 49-50:
Deleted lines 50-61:
To delete all instances of the word "yourword": sed 's/yourword//g' yourfile To delete two words from a file simultaneously: sed -e 's/firstword//g' -e 's/secondword//g' yourfile or sed 's/firstword//g;s/secondword//g' yourfile Added lines 52-83:
(:tableend:) *To delete all instances of the word "yourword": (:table border=1 width=50% bgcolor=yellow cellspacing=0 :) (:cellnr:) [@ sed 's/yourword//g' yourfile@] (:tableend:) *To delete two words from a file simultaneously: (:table border=1 width=50% bgcolor=yellow cellspacing=0 :) (:cellnr:) [@ sed -e 's/firstword//g' -e 's/secondword//g' yourfile @] (:tableend:) or (:table border=1 width=50% bgcolor=yellow cellspacing=0 :) (:cellnr:) [@ sed 's/firstword//g;s/secondword//g' yourfile @] (:tableend:) ---- (:Googlemm:) Changed lines 22-26 from:
sed -e '/^ *$/d' to:
$ sed -e '/^ *$/d' p 33 33 33 Added lines 30-47:
[@ To delete any line containing the word "yourword" from the file "yourfile": sed '/yourword/d' yourfile To delete all instances of the word "yourword": sed 's/yourword//g' yourfile To delete two words from a file simultaneously: sed -e 's/firstword//g' -e 's/secondword//g' yourfile or sed 's/firstword//g;s/secondword//g' yourfile @] Changed lines 6-7 from:
* to:
* Note: "sed -i" overwrites the original file with a new one. [@ $ sed -i 's/123/222/' p @] * -e option indicates that the sed expression follows: [@ sed -e 's/oldstuff/newstuff/g' inputFileName > outputFileName @] * The s stands for substitute. The g stands for global. * The d command to delete lines that are either blank or only contain spaces: [@ sed -e '/^ *$/d' inputFileName @] !!Regular expression metacharacters: *The caret (^) matches the beginning of the line. *The dollar sign ($) matches the end of the line. *The asterisk (*) matches zero or more occurrences of the previous character. Added lines 1-7:
(:Google1:) (:Googletxt:) ---- * sed (stream editor) is a Unix utility that parses text. * Note: "sed -i" overwrites the original file with a new one. * |