Help on sed/awk

hello,

I have been working on extracting a report in Unix and stuck on the following.

The file contents are as follows and I would like to do the following

================================================================================

 Autootaal                              8711768000011                 (AUTOTAAL)
--------------------------------------------------------------------------------

 Directory Entry Type........... N
 Last Call :....................
    Date/Time................... 07/03/09 12:36:29
    Status...................... Successful
    Attempts....................   3
 Max. call retries.............. 999  at   10 minute intervals
================================================================================

 ETS                                    ARENDAL                       (ETSTESTS)
--------------------------------------------------------------------------------

 Directory Entry Type........... N
 Last Call :....................
    Date/Time................... 07/04/27 16:21:28
    Status...................... Successful
    Attempts....................   0
 Max. call retries..............   7  at   10 minute intervals
================================================================================

 Audi Files to ETS System               AUO0932109936351TAE           (AU2ETS00)
--------------------------------------------------------------------------------

 Directory Entry Type........... N
 Last Call :....................
    Date/Time................... 06/02/21 16:01:06
    Status...................... Ftp Code = 000  X.25 Cause = 013  X.25 Diag =
    Attempts....................   7
 Max. call retries..............   7  at   10 minute intervals
================================================================================

The records are separated by " =====" Now I have to parse these records and if the Attempts is more than 0 then only those have to be pulled.
eg above - > ETS has the Attenot as zero, so I have to skip those.

I am new to sed & awk, any help is greatly appreciated.

Thank you
Rakesh

Expected output format ??

Try:

awk '/^==/{if(f)print p; f=0; p=$0; next} END{if(f)print p} {p=p RS $0} /Attempts/{f=$2}' infile
1 Like

Hi Yayan, thanks for the quick reply...

The expected output can be in a separate file as well but it should have the entire records if the attempt made is more than 2.

If you see my original data it contains the 3 record since the Attempt made is 0, it has to be ignored and the expected output should be...

================================================================================

 Autootaal                              8711768000011                 (AUTOTAAL)
--------------------------------------------------------------------------------

 Directory Entry Type........... N
 Last Call :....................
    Date/Time................... 07/03/09 12:36:29
    Status...................... Successful
    Attempts....................   0
 Max. call retries.............. 999  at   10 minute intervals
================================================================================

 Audi Files to ETS System               AUO0932109936351TAE           (AU2ETS00)
--------------------------------------------------------------------------------

 Directory Entry Type........... N
 Last Call :....................
    Date/Time................... 06/02/21 16:01:06
    Status...................... Ftp Code = 000  X.25 Cause = 013  X.25 Diag =
    Attempts....................   7
 Max. call retries..............   7  at   10 minute intervals
================================================================================

---------- Post updated at 06:25 AM ---------- Previous update was at 06:14 AM ----------

Awesome!!! fantastic.... thanks a lot Scrutinizer.
It was fast.. Can you please help me understand this piece..