sed delete line match
Use d option at the end of sed command string for deleting line of matches.
sed -i "" "s/matching_pattern/,+1 d" file.txt #+1 defines number of lines
# to delete after matching line
4.25
4
Use d option at the end of sed command string for deleting line of matches.
tac | sed -i "" "s/matching_pattern/I+1 d" file.txt | tac #
Thank you!
4
0
3.71
7
# You can use awk's field separator (-F) following way:
$ cat file
google.com/funny
unix.stackexchange.com/questions
isuckatunix.com/ireallydo
Thank you!
7
0
0
7
Use d option at the end of sed command string for deleting line of matches.
sed -i "" "s/matching_pattern/d" file.txt
Thank you!
7
0
4
3
Use d option at the end of sed command string for deleting line of matches.
sed -i "" "s/matching_pattern/d" file.txt
Thank you!
3
0
3.9
10
Use d option at the end of sed command string for deleting line of matches.
tac | sed -i "" "s/matching_pattern/I+1 d" file.txt | tac #
Thank you!
10
0
4.14
7
sed '/pattern to match/d' ./infile
Thank you!
7
0
4.17
6
# You can use awk's field separator (-F) following way:
$ cat file
google.com/funny
unix.stackexchange.com/questions
isuckatunix.com/ireallydo
Thank you!
6
0
Are there any code examples left?
New code examples in category Shell/Bash