Script to get the heading in files along with data

Hi everyone,

I have a file which has data with different heading and column names as below.

Static Data Ingested
,,,,,,,,,,,,Known Explained Rejections
Column_1,column_2,Column_3,Column_4,,Column_6,Column_7,,% Column_8,,Column_9 ,Column_10
viv,Public_456,08/28/2013,1234566,,08/31/2013,5896325,,0.00,,0,0
SDS,Public_ddd,08/28/2013,589652,,08/31/2013,2365896,,0.00,,0,1

In the above few are null columns and Static Data Ingested is the heading of therecords at line 1.At line 2 is ,,,,,,,,,,,,Known Explained Rejections and at line 3 and 4 are the column names and the records.

After few lines say line 20 start the second heading and the records as below:

Static Data extracted
Column_1,Column_2,Column_3,Column_4,Column 5,Column_6,Column 7
rms,k2c,5896325,0.00,,0,1
SDS,k3c,2365896,0.00,,0,0

Now i want to get the data from the above records only if Column 9 and 10 in first heading(Static Data Ingested) and column column 6 and 7 in second heading(Static Data extracted) have records other than 0.

For the above input output should be as below.

 
Static Data Ingested:
Column_1,column_2,Column_3,Column_4,,Column_6,Column_7,,% Column_8,,Column_9 ,Column_10
SDS,Public_ddd,08/28/2013,589652,,08/31/2013,2365896,,0.00,,0,1

Static Data extracted:
Column_1,Column_2,Column_3,Column_4,Column 5,Column_6,Column 7
rms,k2c,5896325,0.00,,0,1

What is wrong with this post:

1 Like