The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 11-01-2007
amatheny amatheny is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 2
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?