AW: I should know this - sql output formatting
Posted in 2009
Hi,
the following shell script is a bit tricky but works and should solve
your problem:
pipe=cat
(
dbaccess stores_demo 2>/dev/null <<- !EOF
output to pipe "${pipe}"
without headings
select
"ThisIsAVeryLongLine(1)ThisIsAVeryLongLine(2)ThisIsAVeryLongLine(3)ThisI
sAVeryLongLine(4)ThisIsAVeryLongLine(5)ThisIsAVeryLongLine(6)"
from customer;
!EOF
) | awk '/^[^\\n]/ { line1 = sprintf ("%s", $1); getline; line2 = sprintf
("%s", $1) ; printf ("%s%s\\n", line1, line2)}'
Regards,
Andy
> -----Ursprüngliche Nachricht-----
> Von: SGBoyUK [mailto:iiug@perrior.net]
> Gesendet: Freitag, 14. August 2009 11:49
> An: informix-list@iiug.org
> Betreff: I should know this - sql output formatting
>
>
> In Unix shell (HP-UX 11i and IDS V9.31HC5) using 'output to
> pipe "cat" without headings'; if the result set is wider than
> a terminal screen's worth of characters, the output is split
> onto a newline, making the results unusable.
>
> e.g.
> dbaccess my_database <<EOF
> output to pipe "cat" without headings select a_char_100 from
> mytable EOF
>
> gives me two lines, for example:
>
> a very long string of many many characters indeed that will
> wrap past the
> end of a display
> screen
>
> Note that the second part ("end of a display screen" is
> offset from the left - how can I make dbaccess output this as
> a single string on one line reading "a very long string of
> many many characters indeed that will wrap past the end of a
> display screen"?
>
> NB no we don't have access to Aubit etc.
> _______________________________________________
> Informix-list mailing list
> Informix-list@iiug.org
> http://www.iiug.org/mailman/listinfo/informix-list
>
>