Re: Unload command help
Posted in 1998
In article <6lpdfk$b1e1@webint.na.informix.com>,
no_spam_please@we_are_british.com wrote:
>
> How about creating a file called, say, "do" which contains the following:-
>
> isql nsoe - << EOF
> select field1 from table;> EOF
>
> and then saying the following at the unix prompt:-
>
> do | sed 's/$/ /' | cut -c1-20 > outputfile
>
> That is, never mind unload; just take the output of "select field1 from table"
> and pipe it through "sed" to add twenty blanks to the end of each line, then
> pipe that through "cut" to get the first twenty characters in each row. Seems
> like it should work.
>
> You'll need to edit the first few lines out of "outputfile" because "do"
> will output
>
> +-------------
> |
> |field1
> |
> |000AAABB
> |000AAAC
> |000AAAD
> |...
>
> rather than
>
> +-------------
> |000AAABB
> |000AAAC
> |000AAAD
> |...
>
> - Paul (not a spokesman)
I did not try it, but let me add:
when you use
OUTPUT TO PIPE "mysedscript.sh"
and mysedscript.sh is a script containing Pauls's sed command
and when you also add WITHOUT HEADINGS you will not get the
unwanted line containing the header "field1" ,
i.e., if the file called do contains
isql nsoe - << EOF
OUTPUT TO PIPE "mysedscript.sh"
WITHOUT HEADINGS
select field1 from table;EOF
(Then you maybe still have one blank line at the beginning,but I did not test
this.)
It makes things more compact
Dick
>
> article <35802FEF.C1ABA565@mci.com>, David Hinz <David.Hinz@mci.com> wrote:
> >I need help with an unload command to do the following:
> >
> >- The table has one field: field1 char(10)
> >- All the records in the table look like "0000000ABC" or "0000000AB"
> >>
[ ..... for shortness ..... ]
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading