Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> 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: sfaroult_at_oriolecorp.com 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: ListGuru_at_fatcity.com (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).Received on Wed Oct 01 2003 - 08:29:42 CDT
![]() |
![]() |