I should know this - sql output formatting
Posted in 2009
Topics: Stored Procedures & SPL, Server Administration, Platform-Specific Issues
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.
SGBoyUK wrote:
> 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.
Pity you don't, because SQSL would allow you to specify exactly how to split
(or not split) long text ;-)
This said, I can see there at least two dbaccess defects
1) in spite of the without heading, dbaccess is leaving the space for the
heading in the second and subsequent lines
2) in spite of not running in form mode (and therefore disregarding termcap or
terminfo entries) dbaccess is still putting an arbitrary 80 columns margin: it
should at the very least respond to the COLUMN env var
My only suggestion is to pipe to awk or perl, and join back the two lines
--
Ciao,
Marco
______________________________________________________________________________
Marco Greco /UK /IBM Standard disclaimers apply!
Structured Query Scripting Language http://www.4glworks.com/sqsl.htm
4glworks http://www.4glworks.com
Informix on Linux http://www.4glworks.com/ifmxlinux.htm