UNIX inquiry for 'awk'

Hello Everyone,

May I ask for your help regarding one of the UNIX command �awk�. So I executed a script and the output looks like this (see below):

output.txt

CONTRACTNAME                                                                                                                                                           
CONTRACTKEY                                                                                      STATUS
WirelessSalesWeb use of IRISAutographService_v2_1 (2.1)                                                                                                                
58e9e440-a721-11e4-a161-901f801762ca:2579                                        Production

CONTRACTNAME                                                                                                                                                         
CONTRACTKEY                                                                                      STATUS
WirelessSalesWeb use of CreditCardMgmtService_v1_0 (1.0)                                                                                                               
0882528f-5933-11e4-9ee3-abe338c1dc06:2254                                        Production

But I want the output to be like this (neat column format):

CONTRACTNAME            CONTRACTKEY              STATUS                                                                                                                    
<result>                      <result>                     <result>

Can you help me on this?

How about showing your code so we can hint you to a solution?

Hello RudiC,

What my code does is to read all the data from contracts_report.txt line per line then output the result in output.txt

contracts_report.txt contains the data.
output.txt = result

$ more reports_contract.sh 
#!/bin/sh

SPECS=<path>
OUTPUT_DIR=<path>
LD_LIBRARY_PATH=<path>:$LD_LIBRARY_PATH
PATH=<path>:$PATH
export LD_LIBRARY_PATH
export PATH
export SPECS
sub="%"

cat $SPECS/contracts_report.txt | while IFS= read -r line
do

echo exit | sqlplus -S -L '<username>/<pass>@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=<DB host>)(Port=<DB port>))(CONNECT_DATA=(SERVICE_NAME=<SERVICE_NAME>)))' @$SPECS/<sql query>"'$line$sub'" >> $SPECS/output.txt

done 

But I want the result to be in a neat column format, no need to sort. :slight_smile:

Please use code tags as required by forum rules!

From what I see resp. infer I don't think you need to postprocess your SQL query. Use e.g. set linesize or column format statements in the SQL query to adapt your output format. Pls refer to the sqlplus manual as my sql is somewhat rusty.