I have an input file (refer to extract below) which I am
attempting to convert into an output file as set-out below.
Is this a task suitable for awk to work on? I have attempted
using an approach which searches for the expression "pool"
and gets the subsequent TAPE lines - counting each occurance
under the respective pool heading.
I've ran into problems and do not get the desired result - in particular the "zero" tape occurances are proving problematic to work around.
Can any one help? Help would be appreciated.
Thanks in advance.
=====================================
INPUT DATA FILE:
TAPE SILO MEDIA INVENTORY
---------------------------------
SALES_BACKUP pool
TAPE0050
TAPE0059
TAPE0072
DATABASE_LOG pool
FINANCE pool
TAPE0426
TAPE0021
SCRATCH pool
TAPE0153
TAPE0155
TAPE0159
TAPE0162
DEVELOPMENT pool
TEST pool
====================================
DESIRED OUTPUT FILE:
SALES_BACKUP pool: 3
DATABASE_LOG pool: 0
FINANCE pool: 2
SCRATCH pool: 4
DEVELOPMENT pool: 0
TEST pool: 0
====================================
attempting to convert into an output file as set-out below.
Is this a task suitable for awk to work on? I have attempted
using an approach which searches for the expression "pool"
and gets the subsequent TAPE lines - counting each occurance
under the respective pool heading.
I've ran into problems and do not get the desired result - in particular the "zero" tape occurances are proving problematic to work around.
Can any one help? Help would be appreciated.
Thanks in advance.
=====================================
INPUT DATA FILE:
TAPE SILO MEDIA INVENTORY
---------------------------------
SALES_BACKUP pool
TAPE0050
TAPE0059
TAPE0072
DATABASE_LOG pool
FINANCE pool
TAPE0426
TAPE0021
SCRATCH pool
TAPE0153
TAPE0155
TAPE0159
TAPE0162
DEVELOPMENT pool
TEST pool
====================================
DESIRED OUTPUT FILE:
SALES_BACKUP pool: 3
DATABASE_LOG pool: 0
FINANCE pool: 2
SCRATCH pool: 4
DEVELOPMENT pool: 0
TEST pool: 0
====================================