Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> UNIX SCRIPT ISSUE - URGENT
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
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
![]() |
![]() |