I am working on a shell script to extract information from a file that has output from sqlplus. The problem is the output of a single line is spread across multiple lines and i do not know as how to extract the particular filed at ones,which spans multiple lines. Following is what the file looks like from which i am trying to extract information.
DB1 Jack_ Harris_
DB2 RIck Rice
DB3 Adam Kelly
DB4 Paul_ Darren_
As you can see from the file above, the output is skewed. In the first line the second column has name Jack_Anderson, which is divided in to two lines and there is a blank line between row1 and row 2. My question is how can i extract the individual fields. For eg: the $2 on first line should give me Jack_Anderson and $NR==2 is a blank line, how can i eliminate this in the search to get the exact information? I am using AWK to extract the required complete fields, can anyone shed light on this. I am writing this in KORN shell.