Wierd results with awk

Hey, I'm trying to use awk for some simple file manipulations but i'm getting soem wierd results.

So i want to open up a file which looks like this:

@relation 'autoMpg'
@attribute a numeric
@attribute b numeric
@attribute c numeric
@data
-1.170815,0.257522,0.016416
-1.335653,0.30494,0.009793
-1.227306,0.300442,0.024001

and remove everything except the data, with tabs delimiting the values.

I'm using the following awk script.

gawk ' {OFS="\t"} data { print $1 $2 $3} /@data/ {data = 1} ' autoMpg-3d.arff > tmp.dat

However, no matter what value I enter for OFS, I still always get output like this:

-1.170815,0.257522,0.016416
-1.335653,0.30494,0.009793
-1.227306,0.300442,0.024001

with commas delimiting the values.

Does anyone know whats going on here?

Looks like you did not specify a Field Separator just the Output Field Separator you wanted. Sorry i don't have gawk but in Awk is this close to what you were trying to do?

awk 'BEGIN {FS = ","; OFS="\t"} data { print $1, $2, $3} /@data/ {data = 1} ' ~/Desktop/datainput.txt > ~/Desktop/test.txt

OUTPUT RETURNED:
-1.170815	0.257522	0.016416
-1.335653	0.30494	    0.009793
-1.227306	0.300442	0.024001

Thanks, that fixed it.

I had to use awk instead of awk though. wierd.