In case previous answers didn't satisfy your needs/taste ...:
I think you can use the "read" command to read a line of input (e.g. from an unload file) into several shell variables, word-by-word.
Here, words are separated by spaces. I.e. if you have spaces in your column values, you could escape them with a '\'.
Comsider this example:
% cat bla.sh
#!/bin/sh
read x1 x2 x3
echo "x1: ${x1}"
echo "x2: ${x2}"
echo "x3: ${x3}"
exit
%
% cat bla.in
Here\ we go\ again on\ Friday
%
% cat bla.in | bla.sh
x1: Here we
x2: go again
x3: on Friday
%
So, using a 'traditional' Informix unload file that contains '|' as column separators,
I would first replace all ' ' with '\ ', then all '|' with ' ', then use "read" similar to the above example.
If you don't like a (temporary) unload file, first created with dbaccess and "UNLOAD TO ... SELECT ...",
then you can spend additional time on creating a named pipe and using an external table for the data,
then read the data from that pipe for further processing. But I think, this will involve some synchronization
between pipe reader (your shell script) and pipe writer (dbaccess using the external table): the reader
must start reading before the writer starts writing ...
Regards, Martin
--
Martin Fuerderer Informix Development Germany
| HCL Technologies Germany GmbH Frankfurter Ring 17 80807 Munich, Germany http://www.hcltech.com/de |
::DISCLAIMER::
The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents (with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates. Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this message without the prior written consent of authorized representative of HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. Before opening any email and/or attachments, please check them for viruses and other defects.