Greetings,
I have large file with following format
name1 name2
name3 name4
name5 name6
child7 child8 child9 <== there is leading blank space
child10 child11 child12 <== there is leading blank space
name13 name14
name15 name16
child17 child18 child19 <== there is leading blank space
name20 name21
child22 child23 child24 <== there is leading blank space
child25 child26 child27 <== there is leading blank space
child28 child29 child30 <== there is leading blank space
Basically, there is a "leading space" in the "child" line. When ever found, loop through to print with parent "name" to create above output. If no "child" just print the parent "name".
With my simple knowledge of using 'awk', I can combine two lines, but unable to script a loop to print the parent line along with each child line found. Potentially there several 'child' lines which needs to be combined with parent line. Thanks.
Awesome Yoda.
Yesterday I gave up on AWK and wrote a BASH script this morning. In Bash, with the loops construct, it was taking about 2min to execute for the sample set of 1000 records. But your awk script done executing in blink of an eye.
Thank you very much.
However, upon verification, looks like the last line is not getting printed. Please check it out.
Please recommend a good AWK manual/user guide to get.
Thanks again.