Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get a word

Status
Not open for further replies.

ozi403

Technical User
Apr 29, 2002
54
TR
How can I get the words without "," from the file below?
# more clnt
minilink11, minilink22, minilink44
orasrv
exh3409

I want to get like this :

minilink11
minilink22
minilink44
orasrv
exh3409

thanks.
 
Try this :

awk 'BEGIN {FS=&quot;,&quot;} {for (field=1; field<=NF; field++) print $field }' clnt


Jean Pierre.
 
Have you tried this ?
Code:
tr ',' '\012' </path/to/input >output
Or this:
Code:
IFS=&quot;,$IFS&quot; for word in `cat /path/to/input`
do echo $word
done>output

Hope This Help
PH.
 
This will replace commas (and any following spaces) with newlines...

awk '{gsub(&quot;, *&quot;,&quot;\012&quot;);print}' file1 > file2
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top