Re: Informix reporting
Posted in 2003
Topics: Server Administration, Migration, Import/Export & Data Conversion
redirect stderr to a logfile or /dev/null.
dbaccess sysmaster - 2>/dev/null <<EOF
> select count(*) from systables;> EOF
(count(*))
194
Oh, you want to lose the header too?
export DBDELIMITER=" " # tab or whatnot
dbaccess sysmaster - <<EOF
unload to /tmp/junk
select count(*) from systables;EOF
cat /tmp/junk
194.0
cheers
j.
----- Original Message -----
From: "Farley, Christian" <Christian.Farley@domtar.com>
To: <informix-list@iiug.org>; <ids@iiug.org>
Sent: Thursday, February 20, 2003 11:06 AM
Subject: Informix reporting
> Is there any way to turn off feedback from dbaccess. What i mean is, whan
i
> execute this command :
>
> dbaccess sysmaster abc.sql
>
> the output include the "Database selected","X row(s) retreived" and
> "Database closed".
>
> Can I get rid of theses.
>
> And, is there any formating function.
>
> Thanks,
>
> Christian
>
>
well, it all depends (credit mark scranton...). since you have not stated
what the end is, i offer the following means for unix shell scripts. if
your goal is to create a variable or list of variables (or as i like to say
"variabullize"), then you might try the following:
#script start
#!/bin/ksh
if [ $# -ne 3 ];then
printf "\\
\\\\tUSAGE: $(basename $0) <database > <table name> <column name>
\\
\\
"
exit 1
fi
DB=${1}
TABLE=${2}
COLUMN=${3}
PARSE_LIST=$(echo "select ${COLUMN} from ${TABLE} where <your very own
where clause here...>;" | dbaccess 2>/dev/null ${DB} | sed "s/${COLUMN}//")
for LIST_ITEM in ${PARSE_LIST};do
printf "COLUMN: %-20s\\
" ${LIST_ITEM}
done
#script end
this is not very robust and there are other ways (more elegent i'm sure) to
accomplish this *ahem* variabullization (i love making new words...), but i
hope you get the idea.
Regards,
Bill Roberts
AAIS Core Production Support, Informix DBA
Office : (813) 978-2340
Pager: (813) 304-6503
e-mail:bill.roberts@verizon.com
http://dbaman.tmtrfl.tel.gte.com/browser.cgi
"Jack Parker"
<vze2qjg5@verizon To: ids@iiug.org
.net> cc:
Sent by: Subject: Re: Informix reporting [443]
forum.subscriber@
iiug.org
02/20/03 11:27 AM
redirect stderr to a logfile or /dev/null.
dbaccess sysmaster - 2>/dev/null <<EOF
> select count(*) from systables;> EOF
(count(*))
194
Oh, you want to lose the header too?
export DBDELIMITER=" " # tab or whatnot
dbaccess sysmaster - <<EOF
unload to /tmp/junk
select count(*) from systables;EOF
cat /tmp/junk
194.0
cheers
j.
----- Original Message -----
From: "Farley, Christian" <Christian.Farley@domtar.com>
To: <informix-list@iiug.org>; <ids@iiug.org>
Sent: Thursday, February 20, 2003 11:06 AM
Subject: Informix reporting
> Is there any way to turn off feedback from dbaccess. What i mean is,
whan
i
> execute this command :
>
> dbaccess sysmaster abc.sql
>
> the output include the "Database selected","X row(s) retreived" and
> "Database closed".
>
> Can I get rid of theses.
>
> And, is there any formating function.
>
> Thanks,
>
> Christian
>
>