AW: UNIX : script help/input
Hi Speaking of Perl, ... maybe somebody (Jared) can help out with some Perl / Windows problems: I'm using ActiveState 5.6 with DBI module, which works fine. Now, since I basically work within a CygWin environment on my laptop, I installed perl there, but there are no DBI modules. The basic problem is, that in order to get the DBI stuff compiled within cygwin, you would need a unix/cygwin wrapper for the OCI dlls, which are common windows dlls coming with the Oracle client (9.2.0.4) in order to import OCI stuff correctly, which is needed by DBI (at least I think so). The dlltool doesn't really help me here, since the dlls supplied by Oracle seem to be stripped (at least, dlltool can't find any symbols). If I try: $ nm oci.dll | grep ' T _' | sed 's/.* T _//' oci.def I only get: nm: oci.dll: no symbols Does anybody have an idea how to use the windows oci (or any other Oracle dll) from cygwin ? Otherwise I can also go ahead and toss out cygwin, since accessing Oracle is basically all I need it for. Regards, Stefan -Ursprüngliche Nachricht- Von: Jared Still [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 2. Oktober 2003 00:29 An: Multiple recipients of list ORACLE-L Betreff: RE: UNIX : script help/input Good! The more the merrier! Welcome to the club. Oh most definitely. As I just finished writing a prototype package for assigning MAC addresses ( we make network stuff - that's a technical term ), I have endured the agonies of doing hex math in PL/SQL. I finally bit the bullet and used string manipulation to convert hex to decimal and do what I needed that way. Couldn't get BITAND to work properly on very large integers. Besides, doing XOR with BITAND in PL/SQL is very painful. UTL_RAW has an XOR, but it requires RAW values and I didn't feel like messing with it. This is all very simple in Perl. Given a MAC of 5AA, with a fixed portion of 500, it is very easy to determine the variable portion of the address via $x = 0x5AA ^ 500. Not quite so simple in PL/SQL. Jared On Wed, 2003-10-01 at 14:44, Mladen Gogala wrote: On Wed, 2003-10-01 at 14:34, Jamadagni, Rajendra wrote: Funny .. I am currently sitting in a Perl class, so I can actually read what MG has written. I'll be soon Perl-literate ... Raj Note: This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. Wang Trading LLC and any of its subsidiaries each reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Mladen Gogala INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Jared Still INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Stefan Jahnke INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L
RE: UNIX : script help/input
Title: RE: UNIX : script help/input XOR that gives me some painful memories in recent days ... xor is possible in pl/sql but needs a little work. I migrated a C encryption code to pl/sql and then use utl_tcp to sent it to our router which feeds the modem banks. This is how I worked on it ... but I was working on character by character ... xor(a,b) is r_a := utl_raw.cast_to_raw(chr(a)); r_b := utl_raw.cast_to_raw(chr(b)); n_xor := to_number(utl_raw.bit_xor(r_a,r_b),''); Of course the manual doesn't tell you this ... Raj Rajendra dot Jamadagni at nospamespn dot com All Views expressed in this email are strictly personal. QOTD: Any clod can have facts, having an opinion is an art ! -Original Message- From: Jared Still [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 01, 2003 6:29 PM To: Multiple recipients of list ORACLE-L Subject: RE: UNIX : script help/input Good! The more the merrier! Welcome to the club. Oh most definitely. As I just finished writing a prototype package for assigning MAC addresses ( we make network stuff - that's a technical term ), I have endured the agonies of doing hex math in PL/SQL. I finally bit the bullet and used string manipulation to convert hex to decimal and do what I needed that way. Couldn't get BITAND to work properly on very large integers. Besides, doing XOR with BITAND in PL/SQL is very painful. UTL_RAW has an XOR, but it requires RAW values and I didn't feel like messing with it. This is all very simple in Perl. Given a MAC of 5AA, with a fixed portion of 500, it is very easy to determine the variable portion of the address via $x = 0x5AA ^ 500. Not quite so simple in PL/SQL. Jared This e-mail message is confidential, intended only for the named recipient(s) above and may contain information that is privileged, attorney work product or exempt from disclosure under applicable law. If you have received this message in error, or are not the named recipient(s), please immediately notify corporate MIS at (860) 766-2000 and delete this e-mail message from your computer, Thank you.*2
RE: UNIX : script help/input
Note: This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. Wang Trading LLC and any of its subsidiaries each reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity. It looks like this would make a *great* example for the Stupid Email Disclaimers site http://www.goldmark.org/jeff/stupid-disclaimers/list.html. -- My employers like me, but not enough to let me speak for them. Greg Norris Sprint LTD Database Administration -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Norris, Gregory T [ITS] INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Re: UNIX : script help/input
Johan: Please see the attachment file, which is my script for everyday web server log file and uses nslookup to process the results. Hope that it is helpful. Don Johan Muller wrote: Anybody with a quick and dirty (elegant would be nice too), to munge output from a nslookup output file to a delimited file? 'File content: Server: dns1.mci.com Address: 199.249.19.1 Name:WCOM-4NXZGAPWY5.mcilink.com Address: 166.50.73.209 Delimited file should have the following line(s); (using | or whatever as delimiter): '166.50.73.209'|'4NXZGAPWY5.mcilink.com'. Required for both single and multiple records. TIA #! /bin/ksh # file name: log_file_parsing # Date: March 6,2003; Mar 7,2003; Mar 10,2003; Mar 13,2003; May 7,2003; 12 May,2003; May 15,2003; # May 20,2003; May 30,2003 # # Author: Don Y. # Desc: an example of parsing netTracker related web access from web server (www.welch.jhu.edu) access # log file. Extract client IP, access date, and host IP. This script also transfer client IP # with alphabet into digital one by issuing nslookup command call. Finally make nslookup work # for it outputs a few lines instead of one line. # # define output file WORKING_DIR=$1 OUTPUT_FILE=$WORKING_DIR/log_file_parsing_output.temp INPUT_FILE=$WORKING_DIR/$2 TEMP_NAME=$3 SCRIPT_HOME=/export/users/dony/report # check input access log file exists or not under $WORKING_DIR if [ ! -f $WORKING_DIR/$2 ] then echo input access log file doesn't exist at working directory! exit 1 fi # check output file under working directory exist or not : $WORKING_DIR/log_file_parsing_output.temp if [ ! -f $WORKING_DIR/log_file_parsing_output.temp ] then touch $WORKING_DIR/log_file_parsing_output.temp chown dony:staff $WORKING_DIR/log_file_parsing_output.temp fi # check all temporary files exist or not if [ -f $WORKING_DIR/log_file_parsing_temp01.temp ] then rm $WORKING_DIR/log_file_parsing_temp01.temp else # create an empty file with owner status: dony:staff touch $WORKING_DIR/log_file_parsing_temp01.temp chown dony:staff $WORKING_DIR/log_file_parsing_temp01.temp fi if [ -f $WORKING_DIR/log_file_parsing_temp02.temp ] then rm $WORKING_DIR/log_file_parsing_temp02.temp else touch $WORKING_DIR/log_file_parsing_temp02.temp chown dony:staff $WORKING_DIR/log_file_parsing_temp02.temp fi # file parsing for NetTracker associated lines success=0 cat $INPUT_FILE | grep /cgi-bin/ntlinktrack.cgi | awk '{print $1,substr($4,2,11),$7}' | sed 's/\/cgi-bin\/ntlinktrack.cgi?//' $WORKING_DIR/log_file_parsing_temp01.temp let success=success+$? sed 's/http:\/\/www.welch.jhu.edu\/cgi-bin\/ntlinktrack.cgi?//' $WORKING_DIR/log_file_parsing_temp01.temp $WORKING_DIR/log_file_parsing_temp02.temp let success=success+$? # get start line number here whole_parsing_start_line=`cat $OUTPUT_FILE | wc -l` # change the date format for arg_each_line in `cat $WORKING_DIR/log_file_parsing_temp02.temp | awk '{ print $1===$2===$3 }'` do one_line=`echo $arg_each_line | sed 's/===/ /g'` # debug one line below if enabled #echo $one_line $WORKING_DIR/log_file_parsing_temp03.temp client_ip=`echo $one_line | awk '{ print $1 }' | sed 's/ //g'` org_date=`echo $one_line | awk '{ print $2 }' | sed 's/ //g'` oracle_date=`$SCRIPT_HOME/ldate $org_date` host_ip=`echo $one_line | awk '{ print $3 }' | sed 's/ //g'` # transfer client_ip from alphabet to digital client_addr=`echo $client_ip | egrep -i -e [a-z] | sed 's/ //g'` # get the length of client_addr LENGTH=`expr $client_addr : '.*'` if [ $LENGTH -gt 8 ] then # add pattern of [1-9][1-9] for parsing since nslookup output might be changed /usr/sbin/nslookup $client_addr 2 $WORLING_DIR/$TEMP_NAME | awk '{ print $2 }' | egrep -e [0-9]'.'[0-9]'.' nslookup_result NSR_LINES=`cat nslookup_result | wc -l` if [ $NSR_LINES -eq 2 ];then client_digit=`cat nslookup_result 2 $WORLING_DIR/$TEMP_NAME | awk '( NR == 2 ) { print $0 }'` elif [ $NSR_LINES -eq 3 ];then client_digit=`cat nslookup_result 2 $WORLING_DIR/$TEMP_NAME | awk '( NR == 3 ) { print $0 }'` fi # remove the result file rm nslookup_result 2 $WORLING_DIR/$TEMP_NAME # check whether or not the nslookup command gets a result,which it should be larger than 8 LENGTH=`expr $client_digit : '.*'` if [ $LENGTH -gt 8 ] then client_ip=$client_digit fi fi # output the result echo $client_ip $oracle_date $host_ip $OUTPUT_FILE let success=success+$? done # get whole NetTracker related lines whole_NetTracker_lines=`cat
Re: AW: UNIX : script help/input
A search on 'cygwin perl dbi oracle' revealed a number of URL's that may be helpful. This one looked promising: http://sources.redhat.com/ml/cygwin/2002-08/msg00923.html Jared Stefan Jahnke [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 10/02/2003 03:49 AM Please respond to ORACLE-L To:Multiple recipients of list ORACLE-L [EMAIL PROTECTED] cc: Subject:AW: UNIX : script help/input Hi Speaking of Perl, ... maybe somebody (Jared) can help out with some Perl / Windows problems: I'm using ActiveState 5.6 with DBI module, which works fine. Now, since I basically work within a CygWin environment on my laptop, I installed perl there, but there are no DBI modules. The basic problem is, that in order to get the DBI stuff compiled within cygwin, you would need a unix/cygwin wrapper for the OCI dlls, which are common windows dlls coming with the Oracle client (9.2.0.4) in order to import OCI stuff correctly, which is needed by DBI (at least I think so). The dlltool doesn't really help me here, since the dlls supplied by Oracle seem to be stripped (at least, dlltool can't find any symbols). If I try: $ nm oci.dll | grep ' T _' | sed 's/.* T _//' oci.def I only get: nm: oci.dll: no symbols Does anybody have an idea how to use the windows oci (or any other Oracle dll) from cygwin ? Otherwise I can also go ahead and toss out cygwin, since accessing Oracle is basically all I need it for. Regards, Stefan -Ursprüngliche Nachricht- Von: Jared Still [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 2. Oktober 2003 00:29 An: Multiple recipients of list ORACLE-L Betreff: RE: UNIX : script help/input Good! The more the merrier! Welcome to the club. Oh most definitely. As I just finished writing a prototype package for assigning MAC addresses ( we make network stuff - that's a technical term ), I have endured the agonies of doing hex math in PL/SQL. I finally bit the bullet and used string manipulation to convert hex to decimal and do what I needed that way. Couldn't get BITAND to work properly on very large integers. Besides, doing XOR with BITAND in PL/SQL is very painful. UTL_RAW has an XOR, but it requires RAW values and I didn't feel like messing with it. This is all very simple in Perl. Given a MAC of 5AA, with a fixed portion of 500, it is very easy to determine the variable portion of the address via $x = 0x5AA ^ 500. Not quite so simple in PL/SQL. Jared On Wed, 2003-10-01 at 14:44, Mladen Gogala wrote: On Wed, 2003-10-01 at 14:34, Jamadagni, Rajendra wrote: Funny .. I am currently sitting in a Perl class, so I can actually read what MG has written. I'll be soon Perl-literate ... Raj Note: This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. Wang Trading LLC and any of its subsidiaries each reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Mladen Gogala INET: [EMAIL PROTECTED] Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Jared Still INET: [EMAIL PROTECTED] Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Stefan Jahnke INET: [EMAIL PROTECTED
RE: UNIX : script help/input
Raj, I did consider doing it this way, but the thought of writing stuff to the bit level for a prototype was just too painful. Left pad with zeroes, take a substring, feed it to the handy-dandy hex/oct/bin/dec converter package - much easier. Jared Jamadagni, Rajendra [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 10/02/2003 05:54 AM Please respond to ORACLE-L To:Multiple recipients of list ORACLE-L [EMAIL PROTECTED] cc: Subject:RE: UNIX : script help/input XOR that gives me some painful memories in recent days ... xor is possible in pl/sql but needs a little work. I migrated a C encryption code to pl/sql and then use utl_tcp to sent it to our router which feeds the modem banks. This is how I worked on it ... but I was working on character by character ... xor(a,b) is r_a := utl_raw.cast_to_raw(chr(a)); r_b := utl_raw.cast_to_raw(chr(b)); n_xor := to_number(utl_raw.bit_xor(r_a,r_b),''); Of course the manual doesn't tell you this ... Raj Rajendra dot Jamadagni at nospamespn dot com All Views expressed in this email are strictly personal. QOTD: Any clod can have facts, having an opinion is an art ! -Original Message- Sent: Wednesday, October 01, 2003 6:29 PM To: Multiple recipients of list ORACLE-L Good! The more the merrier! Welcome to the club. Oh most definitely. As I just finished writing a prototype package for assigning MAC addresses ( we make network stuff - that's a technical term ), I have endured the agonies of doing hex math in PL/SQL. I finally bit the bullet and used string manipulation to convert hex to decimal and do what I needed that way. Couldn't get BITAND to work properly on very large integers. Besides, doing XOR with BITAND in PL/SQL is very painful. UTL_RAW has an XOR, but it requires RAW values and I didn't feel like messing with it. This is all very simple in Perl. Given a MAC of 5AA, with a fixed portion of 500, it is very easy to determine the variable portion of the address via $x = 0x5AA ^ 500. Not quite so simple in PL/SQL. Jared encoded content removed -- binaries not allowed by ListGuru
RE: UNIX : script help/input
unfortunately we _had_ to do it in pl/sql ... it is part of the encrypted feed that we send out to our clients ... it is decoded by a chip. Oh well I am back to array of references ... Raj -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]Sent: Thursday, October 02, 2003 2:20 PMTo: Multiple recipients of list ORACLE-LSubject: RE: UNIX : script help/inputRaj, I did consider doing it this way, but the thought of writing stuff to the bit level for a prototype was just too painful. Left pad with zeroes, take a substring, feed it to the handy-dandy hex/oct/bin/dec converter package - much easier. Jared "Jamadagni, Rajendra" [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 10/02/2003 05:54 AM Please respond to ORACLE-L To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED] cc: Subject:RE: UNIX : script help/inputXOR that gives me some painful memories in recent days ... xor is possible in pl/sql but needs a little work. I migrated a "C" encryption code to pl/sql and then use utl_tcp to sent it to our router which feeds the modem banks. This is how I worked on it ... but I was working on character by character ... xor(a,b) is r_a := utl_raw.cast_to_raw(chr(a)); r_b := utl_raw.cast_to_raw(chr(b)); n_xor := to_number(utl_raw.bit_xor(r_a,r_b),''); Of course the manual doesn't tell you this ... Raj Rajendra dot Jamadagni at nospamespn dot com All Views expressed in this email are strictly personal. QOTD: Any clod can have facts, having an opinion is an art ! -Original Message- Sent: Wednesday, October 01, 2003 6:29 PM To: Multiple recipients of list ORACLE-L Good! The more the merrier! Welcome to the club. Oh most definitely. As I just finished writing a prototype package for assigning MAC addresses ( we make network stuff - that's a technical term ), I have endured the agonies of doing hex math in PL/SQL. I finally bit the bullet and used string manipulation to convert hex to decimal and do what I needed that way. Couldn't get BITAND to work properly on very large integers. Besides, doing XOR with BITAND in PL/SQL is very painful. UTL_RAW has an XOR, but it requires RAW values and I didn't feel like messing with it. This is all very simple in Perl. Given a MAC of 5AA, with a fixed portion of 500, it is very easy to determine the variable portion of the address via $x = 0x5AA ^ 500. Not quite so simple in PL/SQL. Jared
Re: UNIX : script help/input
[EMAIL PROTECTED] wrote: Left pad with zeroes, take a substring, feed it to the handy-dandy hex/oct/bin/dec converter package - much easier. Jared, what Oracle edition do you use? I'm asking because you might want to consider not to use 'handy-dandy' hex/oct/bin/dec converter package, but TO_CHAR/TO_NUMBER in case it's = 8i -- it would work faster. SELECT TO_NUMBER(SUBSTR('0x50AA', -6), 'FM0X') dec , '0x' || TO_CHAR(170, 'FM0X') hex FROM dual / -- Vladimir Begun The statements and opinions expressed here are my own and do not necessarily represent those of Oracle Corporation. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Vladimir Begun INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Re: UNIX : script help/input
Jamadagni, Rajendra wrote: unfortunately we _had_ to do it in pl/sql ... it is part of the encrypted feed that we send out to our clients ... it is decoded by a chip. Oh well I am back to array of references ... I'd suggest to consider external C function -- it's faster, it's easier to write especially when you need to work with bits, shifts etc.. I've recently implemented crc32 for some internal project -- works well, obviously faster than SQL, PL/SQL and native comp of PL/SQL code. Native comp. is also good to consider, if it's 9i. Sure, it depends... -- Vladimir Begun The statements and opinions expressed here are my own and do not necessarily represent those of Oracle Corporation. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Vladimir Begun INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: UNIX : script help/input
Title: RE: UNIX : script help/input it was actually C code ... but because data is going on a modem, the pl/sql speed is acceptable (in fact we have to _wait_ after sending out each message). Had fun doing that though ... it is critical, tied to our SLA ... so must be up all the time. I'd rather handle exceptions in pl/sql than in C. Raj -Original Message- From: Vladimir Begun [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 02, 2003 3:35 PM To: Multiple recipients of list ORACLE-L Subject: Re: UNIX : script help/input Jamadagni, Rajendra wrote: unfortunately we _had_ to do it in pl/sql ... it is part of the encrypted feed that we send out to our clients ... it is decoded by a chip. Oh well I am back to array of references ... I'd suggest to consider external C function -- it's faster, it's easier to write especially when you need to work with bits, shifts etc.. I've recently implemented crc32 for some internal project -- works well, obviously faster than SQL, PL/SQL and native comp of PL/SQL code. Native comp. is also good to consider, if it's 9i. Sure, it depends... -- Vladimir Begun The statements and opinions expressed here are my own and do not necessarily represent those of Oracle Corporation. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Vladimir Begun INET: [EMAIL PROTECTED] Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). This e-mail message is confidential, intended only for the named recipient(s) above and may contain information that is privileged, attorney work product or exempt from disclosure under applicable law. If you have received this message in error, or are not the named recipient(s), please immediately notify corporate MIS at (860) 766-2000 and delete this e-mail message from your computer, Thank you.*2
Re: UNIX : script help/input
This database is 8i. I would probably still use the package, as it does octal, hex and binary as well as base 36 and 64. Jared Vladimir Begun [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 10/02/2003 12:24 PM Please respond to ORACLE-L To:Multiple recipients of list ORACLE-L [EMAIL PROTECTED] cc: Subject:Re: UNIX : script help/input [EMAIL PROTECTED] wrote: Left pad with zeroes, take a substring, feed it to the handy-dandy hex/oct/bin/dec converter package - much easier. Jared, what Oracle edition do you use? I'm asking because you might want to consider not to use 'handy-dandy' hex/oct/bin/dec converter package, but TO_CHAR/TO_NUMBER in case it's = 8i -- it would work faster. SELECT TO_NUMBER(SUBSTR('0x50AA', -6), 'FM0X') dec , '0x' || TO_CHAR(170, 'FM0X') hex FROM dual / -- Vladimir Begun The statements and opinions expressed here are my own and do not necessarily represent those of Oracle Corporation. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Vladimir Begun INET: [EMAIL PROTECTED] Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Re: UNIX : script help/input
I would be tempted to use Java for this rather than C. Much more portable than external procedures, an important distinction in a heterogenous shop. Jared Vladimir Begun [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 10/02/2003 12:34 PM Please respond to ORACLE-L To:Multiple recipients of list ORACLE-L [EMAIL PROTECTED] cc: Subject:Re: UNIX : script help/input Jamadagni, Rajendra wrote: unfortunately we _had_ to do it in pl/sql ... it is part of the encrypted feed that we send out to our clients ... it is decoded by a chip. Oh well I am back to array of references ... I'd suggest to consider external C function -- it's faster, it's easier to write especially when you need to work with bits, shifts etc.. I've recently implemented crc32 for some internal project -- works well, obviously faster than SQL, PL/SQL and native comp of PL/SQL code. Native comp. is also good to consider, if it's 9i. Sure, it depends... -- Vladimir Begun The statements and opinions expressed here are my own and do not necessarily represent those of Oracle Corporation. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Vladimir Begun INET: [EMAIL PROTECTED] Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
UNIX : script help/input
Anybody with a quick and dirty (elegant would be nice too), to munge output from a nslookup output file to a delimited file? 'File content: Server: dns1.mci.comAddress: 199.249.19.1 Name: WCOM-4NXZGAPWY5.mcilink.comAddress: 166.50.73.209 Delimited file should have the following line(s); (using | or whatever asdelimiter): '166.50.73.209'|'4NXZGAPWY5.mcilink.com'. Required for both single and multiple records. TIA
RE: UNIX : script help/input
Anybody with a quick and dirty (elegant would be nice too), to munge output from a nslookup output file to a delimited file? 'File content: Server: dns1.mci.com Address: 199.249.19.1 Name:WCOM-4NXZGAPWY5.mcilink.com Address: 166.50.73.209 Delimited file should have the following line(s); (using | or whatever as delimiter): '166.50.73.209'|'4NXZGAPWY5.mcilink.com'. Required for both single and multiple records. TIA awk 'BEGIN{ok=0;}\ {if (($1 == Address:) ok)\ {printf(%s|%s\n, $2, name);ok=0;}\ else {if ($1 == Name:)\ {name = $2; ok = 1;}}}' your_file_here Don't understand your 'single' and 'multiple' records too well but it should get you started. Regards, Stephane Faroult Oriole -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Stephane Faroult INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Re: UNIX : script help/input
I supposed if you send to a file, we can read it using ORACLE to parse it w/plsql and then using utl_file write it back out but seems like overkill to use oracle for that, but then again this is an oracle list, so i'll have to assume thats what you wanted, anyone up for the task :) joe Johan Muller wrote: Anybody with a quick and dirty (elegant would be nice too), to munge output from a nslookup output file to a delimited file? 'File content: Server: dns1.mci.com Address: 199.249.19.1 Name:WCOM-4NXZGAPWY5.mcilink.com Address: 166.50.73.209 Delimited file should have the following line(s); (using | or whatever as delimiter): '166.50.73.209'|'4NXZGAPWY5.mcilink.com'. Required for both single and multiple records. TIA -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Joe Testa INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Re: UNIX : script help/input
#!/usr/bin/perl -w use strict; use bytes; my ($NAME,$IP,@LB); while () { chomp; @LB=split /\s+/; if ($LB[0] =~ /^name:/i) { $NAME=$LB[1]; } if ($LB[0] =~ /^address:/i) { $IP=$LB[1]; write; } } format STDOUT= @ ,@ $NAME,$IP
Re: UNIX : script help/input
Mladen, It worked! Heartfelt thank you from the evangelized perl crowd (now watch the list-owner grin).Mladen Gogala [EMAIL PROTECTED] wrote: #!/usr/bin/perl -wuse strict;use bytes;my ($NAME,$IP,@LB);while () {chomp;@LB=split /\s+/;if ($LB[0] =~ /^name:/i) {$NAME=$LB[1];}if ($LB[0] =~ /^address:/i) {$IP=$LB[1];write;}}format STDOUT=@ ,@$NAME,$IP
Re: UNIX : script help/input
On Wed, 2003-10-01 at 13:24, Johan Muller wrote: Mladen, It worked! Did you have any doubts? That's precisely what perl is good for. Note: This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. Wang Trading LLC and any of its subsidiaries each reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Mladen Gogala INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Re: UNIX : script help/input
Thank God for Perl and Mladen ;) Tanel. - Original Message - From: Johan Muller To: Multiple recipients of list ORACLE-L Sent: Wednesday, October 01, 2003 8:24 PM Subject: Re: UNIX : script help/input Mladen, It worked! Heartfelt thank you from the evangelized perl crowd (now watch the list-owner grin).Mladen Gogala [EMAIL PROTECTED] wrote: #!/usr/bin/perl -wuse strict;use bytes;my ($NAME,$IP,@LB);while () {chomp;@LB=split /\s+/;if ($LB[0] =~ /^name:/i) {$NAME=$LB[1];}if ($LB[0] =~ /^address:/i) {$IP=$LB[1];write;}}format STDOUT=@ ,@$NAME,$IP
RE: UNIX : script help/input
Funny .. I am currently sitting in a Perl class, so I can actually read what MG has written. I'll be soon Perl-literate ... Raj -Original Message-From: Tanel Poder [mailto:[EMAIL PROTECTED]Sent: Wednesday, October 01, 2003 1:35 PMTo: Multiple recipients of list ORACLE-LSubject: Re: UNIX : script help/input Thank God for Perl and Mladen ;) Tanel. - Original Message - From: Johan Muller To: Multiple recipients of list ORACLE-L Sent: Wednesday, October 01, 2003 8:24 PM Subject: Re: UNIX : script help/input Mladen, It worked! Heartfelt thank you from the evangelized perl crowd (now watch the list-owner grin).Mladen Gogala [EMAIL PROTECTED] wrote: #!/usr/bin/perl -wuse strict;use bytes;my ($NAME,$IP,@LB);while () {chomp;@LB=split /\s+/;if ($LB[0] =~ /^name:/i) {$NAME=$LB[1];}if ($LB[0] =~ /^address:/i) {$IP=$LB[1];write;}}format STDOUT=@ ,@$NAME,$IP This e-mail message is confidential, intended only for the named recipient(s) above and may contain information that is privileged, attorney work product or exempt from disclosure under applicable law. If you have received this message in error, or are not the named recipient(s), please immediately notify corporate MIS at (860) 766-2000 and delete this e-mail message from your computer, Thank you.*2
Re: UNIX : script help/input
:) On Wed, 2003-10-01 at 10:24, Johan Muller wrote: Mladen, It worked! Heartfelt thank you from the evangelized perl crowd (now watch the list-owner grin). Mladen Gogala [EMAIL PROTECTED] wrote: #!/usr/bin/perl -w use strict; use bytes; my ($NAME,$IP,@LB); while () { chomp; @LB=split /\s+/; if ($LB[0] =~ /^name:/i) { $NAME=$LB[1]; } if ($LB[0] =~ /^address:/i) { $IP=$LB[1]; write; } } format STDOUT= @ ,@ $NAME,$IP -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Jared Still INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Re: UNIX : script help/input
Thank God for Jared -Original Message- From: Tanel PoderSent: 10/1/2003 10:37:55 AMTo: [EMAIL PROTECTED]Subject: Re: UNIX : script help/input Thank God for Perl and Mladen ;) Tanel. - Original Message - From: Johan Muller To: Multiple recipients of list ORACLE-L Sent: Wednesday, October 01, 2003 8:24 PM Subject: Re: UNIX : script help/input Mladen, It worked! Heartfelt thank you from the evangelized perl crowd (now watch the list-owner grin).Mladen Gogala [EMAIL PROTECTED] wrote: #!/usr/bin/perl -wuse strict;use bytes;my ($NAME,$IP,@LB);while () {chomp;@LB=split /\s+/;if ($LB[0] =~ /^name:/i) {$NAME=$LB[1];}if ($LB[0] =~ /^address:/i) {$IP=$LB[1];write;}}format STDOUT=@ ,@$NAME,$IP ___Get Your 10MB account for FREE at http://mail.arabia.com !Access MILLIONS of JOBS NOW!
RE: UNIX : script help/input
On Wed, 2003-10-01 at 14:34, Jamadagni, Rajendra wrote: Funny .. I am currently sitting in a Perl class, so I can actually read what MG has written. I'll be soon Perl-literate ... Raj Good! The more the merrier! Welcome to the club. Note: This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. Wang Trading LLC and any of its subsidiaries each reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Mladen Gogala INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Re: UNIX : script help/input
Why thank you. :) On Wed, 2003-10-01 at 13:29, Govindan K wrote: Thank God for Jared -Original Message- From: Tanel Poder Sent: 10/1/2003 10:37:55 AM To: [EMAIL PROTECTED] Thank God for Perl and Mladen ;) Tanel. - Original Message - From: Johan Muller mailto:[EMAIL PROTECTED] To: Multiple recipients of list ORACLE-L mailto:[EMAIL PROTECTED] Sent: Wednesday, October 01, 2003 8:24 PM Subject: Re: UNIX : script help/input Mladen, It worked! Heartfelt thank you from the evangelized perl crowd (now watch the list-owner grin). Mladen Gogala [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: #!/usr/bin/perl -w use strict; use bytes; my ($NAME,$IP,@LB); while () { chomp; @LB=split /\s+/; if ($LB[0] =~ /^name:/i) { $NAME=$LB[1]; } if ($LB[0] =~ /^address:/i) { $IP=$LB[1]; write; } } format STDOUT= @ ,@ $NAME,$IP ___ Get Your 10MB account for FREE at http://mail.arabia.com ! Access MILLIONS of JOBS NOW! http://ads.arabia.com/?SHT=text_email_english -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Jared Still INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: UNIX : script help/input
Good! The more the merrier! Welcome to the club. Oh most definitely. As I just finished writing a prototype package for assigning MAC addresses ( we make network stuff - that's a technical term ), I have endured the agonies of doing hex math in PL/SQL. I finally bit the bullet and used string manipulation to convert hex to decimal and do what I needed that way. Couldn't get BITAND to work properly on very large integers. Besides, doing XOR with BITAND in PL/SQL is very painful. UTL_RAW has an XOR, but it requires RAW values and I didn't feel like messing with it. This is all very simple in Perl. Given a MAC of 5AA, with a fixed portion of 500, it is very easy to determine the variable portion of the address via $x = 0x5AA ^ 500. Not quite so simple in PL/SQL. Jared On Wed, 2003-10-01 at 14:44, Mladen Gogala wrote: On Wed, 2003-10-01 at 14:34, Jamadagni, Rajendra wrote: Funny .. I am currently sitting in a Perl class, so I can actually read what MG has written. I'll be soon Perl-literate ... Raj Note: This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. Wang Trading LLC and any of its subsidiaries each reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Mladen Gogala INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Jared Still INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Re: UNIX : script help/input
Jared Jared Still wrote: Good! The more the merrier! Welcome to the club. Oh most definitely. As I just finished writing a prototype package for assigning MAC addresses ( we make network stuff - that's a technical term ), I have endured the agonies of doing hex math in PL/SQL. I finally bit the bullet and used string manipulation to convert hex to decimal and do what I needed that way. Couldn't get BITAND to work properly on very large integers. Besides, doing XOR with BITAND in PL/SQL is very painful. BITAND in PL/SQL works for INTEGER/PLS_INTEGER only. UTL_RAW has an XOR, but it requires RAW values and I didn't feel like messing with it. This is all very simple in Perl. Sure! Given a MAC of 5AA, with a fixed portion of 500, it is very easy to determine the variable portion of the address via $x = 0x5AA ^ 500. Not quite so simple in PL/SQL. Globally unique addresses are allocated by the IEEE in blocks containing 2^24 (16,777,216) addresses. In each allocation, the first 3 octects are fixed (e.g. 00-00-0C is Cisco) and the last three octects are variable (e.g. 00-00-00 through FF-FF-FF). The fixed portion of the allocation is known formally as the Organizationally Unique Identifier (OUI), and infomally as the Ethernet Vendor ID. Often, the OUI portion of a MAC address is extremely helpful in indentifying which physical piece of equipment is generating a particular packet. 00-00-50 is for RADISYS CORPORATION, right? x := SUBSTR('0x50AA', -6); Then you can use BITAND. However, I'm not saying that PL/SQL is better than perl -- every language has its own purpose. -- Vladimir Begun The statements and opinions expressed here are my own and do not necessarily represent those of Oracle Corporation. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Vladimir Begun INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).