Computing.Net > Forums > Unix > displaying words in a row to column

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

displaying words in a row to column

Reply to Message Icon

Name: drew76
Date: April 29, 2003 at 12:02:04 Pacific
OS: Unix
CPU/Ram: unk
Comment:

Hi -

How can I use awk to take names (i.e. D,Liz W,Frank) listed in one row and display in a column? First and Last Name are seperated by a "," and a space defines each field.

Example -

Writing a shell to take a file named 'Employ' and list the names in the row to a column.

Any help is appreciated.



Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: April 29, 2003 at 13:58:30 Pacific
Reply:

I think you want each name, first and last, in one column. You could use awk, but it's boring. How about this:

#!/bin/ksh

sed 's/,/ /g' data.file |xargs -n1
# end script

Use sed to replace each comma with a space, and then pipe it to xargs listing one object per line.

Regards,


Nails


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: displaying words in a row to column

Search for words in a text file www.computing.net/answers/unix/search-for-words-in-a-text-file/7915.html

Find duplicate words in a file www.computing.net/answers/unix/find-duplicate-words-in-a-file/7999.html

delete repeated words in a line www.computing.net/answers/unix/delete-repeated-words-in-a-line-/5862.html