0

I try to find a line in a text file and delete the next line.

I've tested the following code (and some variations) but I'm stuck at the sed command not taking the $ from the stdin therefore not making what I need.

cat test.txt | grep -in mystring | awk -F: '{print $1+1}' | sed -i "$,1d" test.txt

1 Answers1

1

Try this

sed -i '/^yourstring/{n;d}' filename.txt
akash
  • 779
  • 5
  • 16