Penguin
Annotated edit history of sedNotes version 2, including all changes. View license author blame.
Rev Author # Line
1 BenStaz 1 !Extremely handy hint
2
3 In sed, you don't have to use "/" to separate your statement.
4
5 sed 's/this/that/g' is the same as sed 's#this#that#g'.
2 BenStaz 6
7 !How can I EDIT a file using sed?
8
9 Use the ''-i'' switch.
10 This means that the file you supply to sed is overwritten with the changes made by sed.
11 If you don't want to lose the original file then after the ''-i'' switch you can add a backup extension.
12
13 For example:
14
15 *sed -i.bkp '1,2d' test.txt
16
17 This will edit test.txt and the original file can be found in test.txt.bkp