Re: Pesky informational messages in dbaccess
Posted in 1997
Jacob Salomon wrote
>
>This works, basically. However....
>All I want to see the the seelcted data.
>
>I do NOT want the column headings; hence, the grep command in the above
>example(adequate for simple purposes).
>
>I do NOT want the messages like "42 rows selected" and "database
>selected", which go to stderr.
>
>Easy solution which looks like it works:
>
>dbaccess mydatabase - 2>/dev/null | grep-cmd <<%%
>
>This sends all error messges down the oubliette and produces the data I
>want to see. Unfortunately, if an error occurs, I won't see it either.
I would prefer do it in perl - but that's an other story.
>What I *really* need is an option to dbaccess that gives me the bloody
>data, tells me about any errors but omits the pesky informational
>messages I mentioned that I don't want to see.
>
>Any ideas? Besides writing an ESQL/C program to peice together the SQL
>at run time and using dynamic SQL from the SQL descriptor to display the
>info I need.
#!/bin/sh
SQL="select tabid from systables"
TMPF=/tmp/dbaccess.$$
dbaccess xteam - >$TMPF 2>/dev/null <<%%
$SQL
%%
if [ $? -ne 0 ]
then
echo "ERROR:"
head -n 2 $TMPF
else
echo "Your results:"
NRLINES=`wc -l $TMPF | cut -c 1-7`
TLINES=`expr $NRLINES - 4`
HLINES=`expr $TLINES - 1`
tail -n $TLINES $TMPF | head -n $HLINES
fi
rm -f $TMPF
#EOF
Regards,
--
Chris Drauch <cdr@xteam.co.at> ... just speaking for myself ...