using Vi


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers using Vi
# 1  
Old 11-04-2004
Java using Vi

I have 3 column

computes 21312 brand
toastesr 213 brand
printer 2132 brand
tV 1232 brand

I want to display the first and 3 column
I try to use $ awk -f " " `{print $1, " ", $3}' myfilename

and it doenst work.. help.. Smilie
# 2  
Old 11-04-2004
awk -F" " '{print $1, " ", $3}' myfilename
# 3  
Old 11-04-2004
thanx bro that was a good help... Smilie apreciated...
# 4  
Old 11-04-2004
Just for info...

In this case, you don't need (I'm working with GNU awk here) the -F to specify the field separator, nor do you need to specify whitespace in the output, the comma will "expand" to a single space in the output.

e.g.

awk '{ print $1, $3 }' myfilename

Also, for info, you could use cut, but then you'd need to explicitly define the delimiter,

e.g.

cut -d' ' -f1,3 file

Just some thoughts...

Cheers
ZB (always trying to save a few keystrokes Smilie )
# 5  
Old 11-11-2004
Quote:
Originally posted by zazzybob
I'm working with GNU awk here
This is true for every awk and cut I know about, not just the GNU versions.
 
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question