Do you mean something like this?

#!/usr/bin/ksh

cat input_file | while read A B C D JUNK; do
   if [ "$D" != "auto" ]; then
      echo "$A $B $C $D $JUNK" >> error_file
   else
      echo "$A $B $C $D $JUNK" >> ${C}_AUTO
   fi
done

> -----Original Message-----
> 
> A developer in our shop would like to read an input file and 
> based on some
> field values for each record in the file split them into 
> multiple files.  The
> output files will be used by a 3rd party package for 
> processing.  (the package
> does not need the oracle database)  For example:
> 
> Input File:
> record a: WI auto ...
> record b: WI auto ...
> record c: NY auto ...
> record d: YY home ...
> 
> 
> Output file WI_AUTO:
> record a: WI auto ...
> record b: WI auto ...
> 
> Output file NY_AUTO:
> record c: NY auto ...
> 
> Error file:
> record d: YY home ... (no entry in the criteria lookup table 
> to pick up this
> record therefore send it to an error file)
> 
> Their solution is to load an oracle table with the input 
> file.  An additional
> table would contain the criteria and the name of the output 
> file to write to.
> They would write a procedure to read the criteria and input 
> table and utilize
> the utl_file package to create the output files.  There may 
> be 50+ output files
> initially and likely will grow over time.  My gut tells me 
> that this does not
> belong in the database, rather we should be able to split the 
> file using C or a
> utility such as syncsort (which we do not have).  We are 
> currently at 8.1.7.4
> on AIX 4.3.3.  Is there a more elegant solution and what 
> would it be???  Are
> there any open source unix utilities that may help? Thanks
> 
> 
> 
> American Express made the following
>  annotations on 11/13/2003 12:20:23 PM
> --------------------------------------------------------------
> ----------------
> **************************************************************
> ****************
> 
>      "This message and any attachments are solely for the 
> intended recipient and may contain confidential or privileged 
> information. If you are not the intended recipient, any 
> disclosure, copying, use, or distribution of the information 
> included in this message and any attachments is prohibited.  
> If you have received this communication in error, please 
> notify us by reply e-mail and immediately and permanently 
> delete this message and any attachments.  Thank you."
> 
> **************************************************************
> ****************
> 
> 
> ==============================================================
> ================
> 
> -- 
> Please see the official ORACLE-L FAQ: http://www.orafaq.net
> -- 
> Author: Tracy Rahmlow
>   INET: [EMAIL PROTECTED]
> 
> 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: [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.net
-- 
Author: <[EMAIL PROTECTED]
  INET: [EMAIL PROTECTED]

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