I have been trying to retrieve only the file header information from the file using AWK command and store the header string into the variable and then use the variable to append to the log file. Any advise on how can I store the file header information which starts with the string "HEADER" and store the whole line string into variable and append it to the log file.
I tried to use the following command in order to print the header information, unfortunately it's printing the every line in the file.
Awk '{print substr($2,1,length($2))}' file1.dat
Example:
File 1 contains the following Header String:
HEADER 2/16/0515.03.30TIO01676 CMS.TST.IWUNV676.IO01 $
and I want to store the following string to the variable
"HEADER 2/16/0515.03.30TIO01676 CMS.TST.IWUNV676.IO01"
Then append the variable to the log file.
Thanks in advacne for your help!
Russel
I tried to use the following command in order to print the header information, unfortunately it's printing the every line in the file.
Awk '{print substr($2,1,length($2))}' file1.dat
Example:
File 1 contains the following Header String:
HEADER 2/16/0515.03.30TIO01676 CMS.TST.IWUNV676.IO01 $
and I want to store the following string to the variable
"HEADER 2/16/0515.03.30TIO01676 CMS.TST.IWUNV676.IO01"
Then append the variable to the log file.
Thanks in advacne for your help!
Russel