Need solution concatenate and display 2 lines as 1 with a condition for 2 line ?

I have 2 pattern of lines (SQL query and Time taken)in a log i need to capture all SQL queries with time taken >20 sec and need to display as one line.

2 lines from log:

2007-10-23 11:39:17,061 DEBUG [server.startup : 1] [com.fourcs.clm.fw.pem.CLMPEMDBService] - SQL Query : SELECT A.GROUP_CD , C.FN_CD FROM UP_GROUP A , PRD_GROUP_TO_FN B , PRD_FN C WHERE A.GROUP_ID = B.GROUP_ID AND B.FN_ID = C.FN_ID ORDER BY A.GROUP_CD

2007-10-23 11:39:17,061 DEBUG [server.startup : 1] [com.fourcs.clm.fw.pem.CLMPEMDBService] - Time Taken : 640

i have tried to display results Time taken > 20000 by using a command but i want this results to be concatenated with above line(SQL Query line) for Time taken > 20000

Commands:

cd /logs/WS/apps/logs
grep -i 'Time Taken :' /logs/WS/apps/logs/SQLPerformance_x1prdapp7*Node01_C*S*.log > /export/home/jftl784/script/Latest_SQLTIME_TMP.txt
awk '$12 > 20000 {print $0}' < /export/home/jftl784/script/Latest_SQLTIME_TMP.txt > /export/home/jftl784/script/Latest_SQLTIME_TMP_2.txt
grep -v 'Non-deferrable Alarm :' < /export/home/jftl784/script/Latest_SQLTIME_TMP_2.txt > /export/home/jftl784/script/Latest_SQLTIME_MSGS_$1.txt

No duplicate or cross-posting, read the rules.

Proceed here:

http://www.unix.com/shell-programming-scripting/72883-concatenate-display-2-lines-1-condition-2-line.html\#post302213586

Thread closed.