Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: UNIX SCRIPT ISSUE - URGENT
No unix expert but the first option can be achieved automatically by running the following script
for filename in `ls *.file`
do
unix script as listed
done
Rename a couple of the files and try out the syntax and work out the timings. Once it all works properly then rename some of the files (extensions at least) and set the scripyt off a numver of times in the background (nohup scriptname &) and the work can be spread around between processors on the system
For the 2nd option I would have thought AWK was the required utility but can offer nothing more substantial than that at the moment
John
-----Original Message-----
From: Johan Muller [mailto:bad_dba_at_yahoo.com]
Sent: 25 July 01 15:26
To: Multiple recipients of list ORACLE-L
Subject: 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
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Johan MullerReceived on Wed Jul 25 2001 - 09:51:53 CDT
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). ********************************************************************** This email and any attachments may be confidential and the subject of legal professional privilege. Any disclosure, use, storage or copying of this email without the consent of the sender is strictly prohibited. Please notify the sender immediately if you are not the intended recipient and then delete the email from your inbox and do not disclose the contents to another person, use, copy or store the information in any medium. **********************************************************************
![]() |
![]() |