Formatting isql output to horizontal format

Hi

I am formatting informix isql output(vertical) to horizontal format. Suppose I have the following content in the flat file from isql output -

item_nbr 0
usfn_label Subscriber Class
usfn_name SBCLASS
usfn_value bl5

item_nbr 1
usfn_label Switch Name
usfn_name switchName
usfn_value pyrw2

I have to format it like -

item_nbr usfn_label usfn_name usfn_value

   0 Subscriber Class          SBCLASS              bl5
   1 Switch Name               switchName          pyrw2

I printed the column headers in the output file and then I want to get the column values. I used 'cut' to get the values like this in a file tmp-

0
Subscriber Class
SBCLASS
bl5

1
Switch Name
switchName
pyrw2

Now the problem is whenever I am trying to print the values in the output file, they are appearing with newline (\n) and I am not getting the horizontal format. As if there is a newline after '0', 'Subscriber Class' etc and the print command is also printing the newline -

while read line
do
if [ -n "$line" ];then
print "$line\t" >> out
else
print "\n" >> out
fi
done<tmp

But 'out' has the same format like 'tmp' :frowning: . I have tried several values for IFS without any success.

So how we can read vertically and print them horizontally ????

Please show me the light ....

Thanks

try:

cut -f2- -d" " file | xargs -n5

Is it possible to change isql command .. Which will better that a shell script ..

Check with
SyBooks Online

-w columnwidth
Default= 80 characters
meaning = Changes the line width