Hi Gurus,
I have a file with the FOLLOWING CONTENTS
here is a little snapshot of it. The actual file may contains more than 1000 lines. I have also put line numbers against each line. so lets say the following file (line 1-12) name is test.csv.
1.Report for states
2.Alabama
3.Michigan
4.Connecticut
5.MONTHLY REPORT - ALABAMA DIVISION
6.01,987,765,980, 345.00
7.44,56,675,380,450.00
8.MONTHLY REPORT - ALABAMA HQ
9.32,767,876,560,450.00
10.44,876,908,787,430.05
11.
12.END OF REPORT
I want to delete lines which doesn't begins with a number or 'MONTHLY REPORT' next thing is as you see line 5 has MONTHLY REPORT - ALABAMA DIVISION. I want to put on line 6 and 7 AD(ALABAMA DIVISION) at the start of line so line 6 should look like
AD,01,987,765,980, 345.00 and line 7 should look like
AD,44,56,675,380,450.00
line 8 has ALABAMA HQ so line 9 and 10 should look like
AH,32,767,876,560,450.00
AH,44,876,908,787,430.05
line 11 is blank so I need to delete that line
line 12 also should get deleted
in the end the file should look like following
AD,01,987,765,980, 345.00
AD,44,56,675,380,450.00
AH,32,767,876,560,450.00
AH,44,876,908,787,430.05
I have a file with the FOLLOWING CONTENTS
here is a little snapshot of it. The actual file may contains more than 1000 lines. I have also put line numbers against each line. so lets say the following file (line 1-12) name is test.csv.
1.Report for states
2.Alabama
3.Michigan
4.Connecticut
5.MONTHLY REPORT - ALABAMA DIVISION
6.01,987,765,980, 345.00
7.44,56,675,380,450.00
8.MONTHLY REPORT - ALABAMA HQ
9.32,767,876,560,450.00
10.44,876,908,787,430.05
11.
12.END OF REPORT
I want to delete lines which doesn't begins with a number or 'MONTHLY REPORT' next thing is as you see line 5 has MONTHLY REPORT - ALABAMA DIVISION. I want to put on line 6 and 7 AD(ALABAMA DIVISION) at the start of line so line 6 should look like
AD,01,987,765,980, 345.00 and line 7 should look like
AD,44,56,675,380,450.00
line 8 has ALABAMA HQ so line 9 and 10 should look like
AH,32,767,876,560,450.00
AH,44,876,908,787,430.05
line 11 is blank so I need to delete that line
line 12 also should get deleted
in the end the file should look like following
AD,01,987,765,980, 345.00
AD,44,56,675,380,450.00
AH,32,767,876,560,450.00
AH,44,876,908,787,430.05