Answers for "delete line in sed"

4

sed remove line containing

sed '/pattern to match/d' ./infile
Posted by: Guest on December-23-2020
2

delete a line starting with sed

# Delete all lines starting with '#'
$ sed -i '/^#/d' filepath
Posted by: Guest on July-07-2020
2

delete line in sed

# -i here update the file, try with and without -i, 
sed -i -e "/your_pattern/d" file 
sed -i -e "/your_pattern/,+2 d" file  # 2 lines after the pattern
sed -i -e '5,5d"  # remove 5th line
Posted by: Guest on June-15-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language