for i in `ls`
do
YourScript.shl $i
done

Unless you are also processing your newfile.dat in the script you need
to make unique names for the output files.
Something like:
sed "s/Report by Hosts/$IP| Report by Hosts/" $FN > new_${FN}.dat
so you will get an output file from each input file.


> -----Original Message-----
> From: Johan Muller [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 25, 2001 10:26 AM
> 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
> 
> __________________________________________________
> 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: [EMAIL PROTECTED]
> 
> 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: [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.com
--
Author: Anderson, Brian
  INET: [EMAIL PROTECTED]

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: [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).

Reply via email to