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

Home -> Community -> Mailing Lists -> Oracle-L -> UNIX SCRIPT ISSUE - URGENT

UNIX SCRIPT ISSUE - URGENT

From: Johan Muller <bad_dba_at_yahoo.com>
Date: Wed, 25 Jul 2001 06:28:06 -0700
Message-ID: <F001.00354596.20010725062612@fatcity.com>

I need to extract the first 16 bytes of a filename (AIX 4.3) which consists of an IP address (nnn.nnn.nnn.nnn), and move that to first 16 positions in the file itself, plus adding a pipe (|) sign for a delimiter, and save the IP address as a file name with a .dat extension, before loading the contents into a table.

My predecessor concocted the following:

#!/usr/bin/ksh
 FN=$1
 IP=`echo $FN|cut -c1-16`
 sed "s/Report by Hosts/$IP| Report by Hosts/" $FN > newfile.dat  #-- End of file

which is great for a single file at a time.

Right now I have to perform this surgery on 19 986 files, which is in one place.
Using the script above would take me over 20 000 hours.

Any way I can grab the files one at the time based on a ls command, and invoke the script, and to end up when the last file has been processed.

ALTERNATIVE: Each file contains the IP address which has to move into the first position after a string on line 13 which you guessed it: is called 'IP Address:'. Is their a way vi could be used to achieve the same result?

Any input would be appreciated,

Johan Muller



Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Johan Muller
  INET: bad_dba_at_yahoo.com
Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
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 Jul 25 2001 - 08:28:06 CDT

Original text of this message

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