Derived both lines base on pattern

Dear All,
I have a requests to retrieve all lines if second line last columns meets certain criteria.

Here is the output of the result

Table: DSSBDW.DA_MASK_CLK_AR
120908 0 86 86 - 1934528 0 70 100 -*-
Table: DSSBDW.DA_MASK_CLK_IP
310657 22030 143 185 - 5281169 7 88 77 *-*
Table: DSSBDW.DA_MASKING
687265 0 574 582 - 18556156 0 97 98 ---
Table: DSSBDW.DA_MASKING_AR
621320 0 287 1281 - 9319800 0 22 22 -**
Table: DSSBDW.DA_MASKING_IP
- - - - - - - - - ---
Table: DSSBDW.DBT_IMT
190872 0 412 412 - 13170168 0 98 100 ---

::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.

Expected output

Table: DSSBDW.DA_MASK_CLK_AR 120908 0 86 86 - 1934528 0 70 100 -*-
Table: DSSBDW.DA_MASKING_AR 621320 0 287 1281 - 9319800 0 22 22 -**
Table: DSSBDW.DA_MASK_CLK_IP 310657 22030 143 185 - 5281169 7 88 77 *-* 

Thanks.

bash-3.2$ awk '/Table/{a=$0}/\*$/{print a,$0}' a.txt
Table: DSSBDW.DA_MASK_CLK_IP 310657 22030 143 185 - 5281169 7 88 77 *-*
Table: DSSBDW.DA_MASKING_AR 621320 0 287 1281 - 9319800 0 22 22 -**

This seems to more accurately produce the requested output:

awk '/^Table/{a=$0;next}index($NF,"*"){print a,$0}' file

which, with the sample input provided, produces the output:

Table: DSSBDW.DA_MASK_CLK_AR 120908 0 86 86 - 1934528 0 70 100 -*-
Table: DSSBDW.DA_MASK_CLK_IP 310657 22030 143 185 - 5281169 7 88 77 *-*
Table: DSSBDW.DA_MASKING_AR 621320 0 287 1281 - 9319800 0 22 22 -**

Note, however, that the output here is the order in which the lines appeared in the input file; not in the order you requested in your sample output.

if you want to print the last column has asterisk symbol, then use this..

bash-3.2$ awk '/Table/{a=$0}$NF~/*/{print a,$0}' a.txt
Table: DSSBDW.DA_MASK_CLK_AR 120908 0 86 86 - 1934528 0 70 100 -*-
Table: DSSBDW.DA_MASK_CLK_IP 310657 22030 143 185 - 5281169 7 88 77 *-*
Table: DSSBDW.DA_MASKING_AR 621320 0 287 1281 - 9319800 0 22 22 -**

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:

awk '/Table/{a=$0}$NF~/[*]/{print a,$0}' file

Another approach:

perl -nle '/\*(-+)?$/ and print "$p $_"; $p=$_' ckwan123.file
Table: DSSBDW.DA_MASK_CLK_AR 120908 0 86 86 - 1934528 0 70 100 -*-
Table: DSSBDW.DA_MASK_CLK_IP 310657 22030 143 185 - 5281169 7 88 77 *-*
Table: DSSBDW.DA_MASKING_AR 621320 0 287 1281 - 9319800 0 22 22 -**
Table: DSSBDW.DBT_IMT 190872 0 412 412 - 13170168 0 98 100 *--