At first, I hardcode the header and use awk to retrieve the value line by line. e.g:
A=`awk 'NR==3 {
for(i=1;i<=NF;i++){
if ( $i == "first" ) {
print $3 $4
}
}
}' file`
However, the details: 1 and and details: 2 is different.Any idea on how to parse this file? Need it urgently. Thanks for help!
When you have Detail line, previous record end => print variables.
After last record you have not Detail line, so after everything END block you must print last record variables.
I can't see your code ? How did you try it to use ? My code was only "proto", idea of parsing input and make output. Learning awk, not only cut&paste. Giving idea of scripting, in this case using awk. I think that in this forum we are waiting that you have basic knowledge from tool what you are using/asking helps.
Subject is "how to parse this file in unix", better subject is
"how to parse this file using awk", if you like to know/learn solution using awk.
Good subject help me( us ) to browse all subject and which are maybe for just for me. Too generally subjects make this "hoppy" hard - too much noice.