Unix Programming - awk

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > September 2005 > awk





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author awk
James

2005-09-23, 7:50 am

grep Glen ~/Check| awk -F " " "{ print $1 }"

I have a file filled with name separated by spaces how can i edit the line
above to split by space


shakahshakah@gmail.com

2005-09-23, 7:50 am

James wrote:
> grep Glen ~/Check| awk -F " " "{ print $1 }"
>
> I have a file filled with name separated by spaces how can i edit the line
> above to split by space


Not sure I read your question correctly, but how about something like:

jc@soyuz:/tmp$ awk 'BEGIN { FS=" " } { print $2 "," $1 }' << EOT
> John Glenn
> Buzz Aldrin
> EOT

Glenn,John
Aldrin,Buzz
jc@soyuz/tmp$

?

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com