Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Use AWK to convert SQLNET (NET8) LEVEL 16 PACKETS TO LONG LINES.

Use AWK to convert SQLNET (NET8) LEVEL 16 PACKETS TO LONG LINES.

From: Baligeko <paul.kindervater_at_oracle.com>
Date: 19 Dec 2001 05:20:42 -0800
Message-ID: <31d827a2.0112190520.6adb075b@posting.google.com>


Have you ever wanted to convert somthing like:

nspsend: 00 2F 00 00 06 00 00 00  |./......|
nspsend: 00 00 03 03 08 01 00 00  |........|
nspsend: 00 20 32 48 00 16 00 00  |. 2H....|
nspsend: 00 53 45 4C 45 43 54 20  |.SELECT |
nspsend: 55 53 45 52 20 46 52 4F  |USER FRO|
nspsend: 4D 20 44 55 41 4C 00 00  |M DUAL..|

to:

nspsend:
020000000000000002340100054444525545245442454400 0F0060000033810000280600035C53405352062FD0451C00 ./............... 2H.....SELECT USER FROM DUAL.. in order to see (and search for) the full SQL?

Then ftp ascii your files to UNIX,
and use the following AWK script.
e.g. awk -f myfile.awk sqlnet.trc > output.txt sometime nawk works better than awk.



# Assumptions
# - only packet lines have two pipe symbols
# - there are other lines after the last packet
# - hex tuplets are in pos 9,12,15,18,21,24,27,30 (ORA V7)
# 17 (ORA V8)
# - the nspsend: also starts different in V7 and V8
# - the pipe symbol has to now be escaped in the RE.
# - the output of very long lines should be read in wordpad on PC.
#

BEGIN {FS = "|";T1="";T2="";T3=""}
$0  ~ /\|........\|/	{         
			flag=1
			prev = $0
			for (i = 0; i < 8; ++i)
				{
				T1=T1""substr($0,10+i*3,1)
				T2=T2""substr($0,11+i*3,1)
				}
			i = NF - 1
			T3=T3$i
			next
			}
			{if ( flag==1 )
				{
				flag = 0
				print substr(prev,1,8)

# print substr(prev,8,8)
print T1 print T2 print T3 print "" T1="";T2="";T3="" } }

### EOF ###


If you have problems with:
$0 ~ /\|........\|/
then use:
NF == 3

Have fun,
Paul Kindervater Received on Wed Dec 19 2001 - 07:20:42 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US