Re: without headings (was Missing UNLOAD)
Posted in 1992
Topics: Server Administration, Migration, Import/Export & Data Conversion
Alan writes:
> output to pipe "tr '[a-z]' '[A-Z]'" without headings select * from gen_ids;
Tony responds:
> I still get blank lines ...
Try this:
output to pipe 'egrep -v "^$" | tr "[a-z]" "[A-Z]"' without headings
select * from gen_ids;
Now if you're working in Bourne shell and do this from a command line, it would look like this:
$ isql dbase - <<EOF 2> /dev/null
> output to pipe 'egrep -v "^$" | tr "[a-z]" "[A-Z]"' without headings
> select * from gen_ids;> EOF
The result shows one trailing blank line. Or is it? When the stdout is
redirected to a file and the file examined there _is_ one trailing blank
line. So why didn't it get caught like the others? Simple. The trailing
blank line isn't terminated with a line feed.
The alternative is:
$ isql dbase - <<EOF 2> /dev/null | grep -v '^$'
> output to pipe 'tr "[a-z]" "[A-Z]"' without headings
> select * from gen_ids;> EOF
which gets rid of all blank lines, even those fields which are blank.
This might not be such a good idea to do in all cases.
By the way, the reason for the '2> /dev/null' is to get rid of the
message which says how many rows were retrieved.
------------------------------------------------------------------------------
John R. Carter, Sr. Programmer/Analyst - Informix DBA
Computer Sciences Corporation jcarter@nas.nasa.gov
Numerical Aerodynamic Simulation 415/604-3662
NASA Ames Research Center, Moffett Field, CA 94035-1000 M/S 258-6
------------------------------------------------------------------------------