Hi,
for this purpose I use the following perlscript on Linux. Just name the script as you like, store it in a PATH-directory and make it executeable. Then use it in dbaccess by selecting Output - To-pipe and entering the name of the script.
It's not perfect in the way that with empty columns in the output it starts a newline but I only use it to generate new SQL statements with a query and for that it works fine.
In this form it doesn't work on Windows but I guess it's possible to make it work.
Code:
#!/usr/bin/perl
use warnings;
use strict;
sub quotes
{
my $string = shift;
my $cnt = 0;
my $idx = -1;
if (($idx = index($string, "\"")) >= 0)
{
$cnt = $cnt + 1 + quotes(substr($string, $idx + 1));
}
return $cnt;
}
my $line = "";
my $quote = 0;
while (<>)
{
my $i = (my @inp = split);
if ($i > 1)
{
for (my $j = 1; $j < $i; $j++)
{
my $text = $inp[$j];
chomp $text if ($j == $i);
$quote = quotes($line);
if ($line ne "")
{
if ($quote % 2 == 0 ||
(substr($line, -1) !~ "\"" && substr($text, 0, 1) !~ "\""))
{
$text = " " . $text;
}
}
$quote = 0;
$line = $line . $text;
}
}
elsif ($line !~ /^$/)
{
print "$line\n";
$line = "";
}
}
print "$line\n";
Regards,
Hans