The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 03-19-2009
Juha Juha is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 36
Thanks franklin, did not work for me however..


Code:
# awk '/ProcessType:/ && !p {i=-4;p=1} i++ > 0' file
awk: syntax error near line 1
awk: bailing out near line 1

With nawk it executes but only deletes the first occurrence of that "block"


Code:
# nawk '/ProcessType:/ && !p {i=-4;p=1} i++ > 0' file
ProcessType:    PROCESS_A (0)
SequenceNumber: 8286

2009 Mar 07  22:04:23:679   0:8286

ProcessType:    PROCESS_B (68)
SequenceNumber: 40689

2009 Mar 07  22:04:23:698  68:40689

DATA that should not be deleted

ProcessType:    PROCESS_B (68)
SequenceNumber: 40690
...