Hi all,I am really new to Shell Scripting.I have the following doubt.
Let us assume the one sample file which contains the below data
HEADERCARMENTRACIE1555090414
PERIOD0905090501090531
DETAIL0645693037023073836
GROUNDAV 090501 01
GROUNDAV 090502 01
TRIP 0091282542 0905084101
DETAIL0611399053434111413
TRIP 0091232008 0905034101
GROUNDAV 090506 01
Now
In the above file If u see the line starting with "DETAIL" it contains the employee number(from position7-13)i.e.,0645693.
Now I want to append that employee_Number to all the other subsequent lines until I find an another line starting with the word "DETAIL".
If it is again a DETAIL then repeat the above process.
The sample output of the file after doing above operation is as follows.
HEADERCARMENTRACIE1555090414
PERIOD0905090501090531
DETAIL0645693037023073836
0645693GROUNDAV 090501 01
0645693GROUNDAV 090502 01
0645693TRIP 0091282542 0905084101
DETAIL0611399053434111413
0611399TRIP 0091232008 0905034101
0611399GROUNDAV 090506 01
Can you please help me in find solution to this problem.
Thank u