Delete Previous Line if Current Line Contains Particular Keyword

In UNIX delete previous line if current line contains particular keyword

Showing Answers 1 - 1 of 1 Answers

SWETA SANWAL

  • Jan 12th, 2017
 

sed -n /pattern/{x;d;};1h;1!{x;p;};${x;p;} <>

  Was this answer useful?  Yes

sambasivarao

  • May 25th, 2017
 

grep -v "$(grep -B1 | head -1)"

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Answer Question

Click here to Login / Register your free account


 
Send   Reset

 

Related Answered Questions

 

Related Open Questions