Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cutting block of data out of file

Status
Not open for further replies.

Kipnep70

Technical User
Nov 18, 2003
81
US
I have an output that displays when my backup tapes are going to expire. However I want to only display the tapes that are going to expire within the next week. My out put looks something similiar to this:

..
..
ACTIVE FULL SUSPENDED FROZEN IMPORTED
224 1291 3027 21 15

Number of NON-ACTIVE media that:
17 - are non-active and not written yet
106036 (FROZEN)
106023 (FROZEN)
103254 (FROZEN)
106022 (FROZEN)
..
..
546 - will expire within 1 week
..
..
000040 expires 06/15/2006 18:03
107912 expires 06/15/2006 18:05
000816 expires 06/16/2006 00:03
107734 expires 06/15/2006 20:02
107922 expires 06/15/2006 18:32
107934 expires 06/16/2006 00:03
101758 expires 06/19/2006 02:09
104223 expires 06/19/2006 01:13 (SUSPENDED)
100027 expires 06/19/2006 01:13 (SUSPENDED)
103791 expires 06/19/2006 01:27 (SUSPENDED)
105719 expires 06/19/2006 01:14 (SUSPENDED)
106671 expires 06/19/2006 01:33 (SUSPENDED)
...
...
578 - will expire between 1 and 2 weeks
..
..
..


I only way to display the tape NUMBERS (#####) that are inbetween the headers "...will expire within 1 week" and ".... will expire between 1 and 2 weeks."

Then I'll do something like an awk '{print $1}' to get just the tape number.


.. = ommited text

thanks,

nk
 
I forgot to mention that this output file continues listing when the future media will expire such as 2 - 3 weeks, 3 -4 weeks, 1 month, 2 month .. etc

I just the information listed within the first week.
 
A starting point:
awk '
/between 1 and 2/{exit}
f && /expires/{print $1}
/within 1 week/{++f}
' /path/to/input > output

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top