linux:sed
Table of Contents
Sed
Delete Line in File
To delete line 7 of test.txt
sed -i 7d test.txt
Delete Line with Text
sed '/^WHOLELINEOFTEXT$/d' input.txt > output.txt
Append to All Lines
To add text to the end of each line in the file test.txt and put the result into test2.txt
sed 's/$/newtexttoaddon/g' test.txt > test2.txt
To Prepend to All Lines
To add text to the start of each line in the file test.txt and put the result into test2.txt
sed 's/^./newtexttoaddon/g' test.txt > test2.txt
linux/sed.txt · Last modified: by 127.0.0.1
