Dispaying output in tabular form

hi,

I have a script which is dispaying the output as below:

 
Column 3:value1
Column 4:value 4
column 8:value 8
column 9:value 9
column 13:value 13
Column 3:value10
Column 4:value 40
column 8:value 80
column 9:value 90
column 13:value 103

However,I need the output in tabular form as below

 
column 1 column 4 column 8 column 9 column 13
value 1 value4 value 8 value 9 value 13
value 10 value40 value 80 value 90 value 103

I am using below awk command for the above output but it is not coming in tabular form:

awk -F, '($13=="") {print "error"; exit 1}
(NR==1){h3=$3;h4=$4;h8=$8;h9=$9;h13=$13;next}
 (NF>1){print h3": "$3"\n"h4": "$4"\n"h8": "$8"\n"h9": "$9"\n"h13": "$13}
' $IFILE>>$OFILE

I can see why it wouldn't work for you, when your data's separated by : and you're using , as a separator and you never have 13 columns but are checking for column 13!

awk -F: -v OFS="\t" -v W=4 '(++R)<=W { A=A OFS $1 ; B=B OFS $2 ; next }
{
        print substr(A, 2);
        print substr(B, 2);
        R=0;
}

END {
        if(R>0)
        {
               print substr(A,2);
               print substr(B,2);
        }
}' inputfile

Is their any other simple way..I think we can use HTML tags or some different way.

---------- Post updated at 06:46 PM ---------- Previous update was at 06:43 PM ----------

I have field separator as , only and there are total 13 columns in file out of which I am displaying 5 columns.

Please show us your input file and the output you want to see.

Showing us output you don't want, and the script that produces the output you don't want makes it hard for us to come up with a realistic test case to see if we can give you something that does what you do want.

input file as below which is , separated.

 
column1,column2,column3,column4,column5,column6,column7
value1,value2,value3,value4,value5,value6,value7
value11,value21,value31,value41,value51,value61,value71

I am using the below command do get the output

 
IFILE=/home/home1/Report1
OFILE=/home/home1/`date +"%m%d%y%H%M%S"`.dat
if [ -r $IFILE ]  #Checks if file exists and readable
then
awk -F , 'int($6)!="0"||int($7)!="0" {printf "Colum1:                        %s\ncolumn2:                                 %s\ncolumn3:             %s\nFile column4:                                 %s\ncolumn5:              %s\ncolumn6 :       %s\nColumn7:    %s\n",$1,$2,$3,$4,$5,$6,$7}' $IFILE
fi

The above is giving output as below:

 
column1:value1
column2:value2 

and so on

 
I need the output in tabular form
column1  column2  column3  column4  column5  column6  column7
value1      value2     value3    value4   value5   value6   value7
value11   value21     value31    value41   value51   value61   value71

I belive using HTML tags we cam do but not sure how can we use in my script.

Since none of the data in your sample input file is numeric, the awk script you gave in the last message will produce absolutely no output.

If it did find non-zero data in fields 6 and 7 of your input file, the output would start with:

Colum1:                        value1

rather than:

column1:value1

When you drastically change your requirements between posts and give us sample input data, sample code, and sample output data that don't match, there isn't much incentive for us to try to guess what you really want nor to try to help you come up with a solution for your problem.

If you just want to print your input csv file as a tab separated table instead of converting it to a columnar form as done by your sample awk scripts, the simple thing to do is:

awk -F, '{$1=$1;print}' OFS='\t' "$IFILE"

which (with your sample input from your previous message) will produce the output:

column1	column2	column3	column4	column5	column6	column7
value1	value2	value3	value4	value5	value6	value7
value11	value21	value31	value41	value51	value61	value71