Skip to main content
7 of 7
edited tags
don_crissti
  • 85.6k
  • 31
  • 234
  • 262

Find each line matching a pattern but print only the line above it

I need to find a string and need to print the line above it.

case1: The same line won't have the more than one matching pattern

ie) consider a file containing

$cat > para
returns between the paragaraphs
italic or bold    
quotes by placing
italic

Here i need to find for italic, and i need to get the output as below

returns between the paragaraphs
quotes by placing

How can i get the output like this?

jevan
  • 41
  • 1
  • 5