::For information Table name and next line is first and second line and not continous line.
What I want is to retrieve whenever the second line last column has any asterisk in and position, I will want to retrieve the table name before the line as well as the current line and put it into a single line.
That will work on some systems, but it isn't portable. The asterisk is a meta-character in an ERE. On some systems (such as BSD and OS X), you will get an error like:
$ awk '/Table/{a=$0}$NF~/*/{print a,$0}' file
awk: illegal primary in regular expression * at
source line number 1
context is
>>> /Table/{a=$0(NF)~/*/ <<<
instead of the output you got with your version of awk . But, either of the following should work reliably with any standards-conforming awk implementation:
awk '/Table/{a=$0}$NF~/\*/{print a,$0}' file
escaping the asterisk as you did in post #2 in this thread, or using a matching list bracket expression: