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 02-11-2009
eltinator eltinator is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 63
Replace comma with newline

Hi, for some reason I cant seem to figure this out. I have a file which looks something like this

word
word
word
word
word,word,word
word
word
word,word,word,word,word
word
word

Basically I want this whole thing to be a list with 1 word on each line like this...

word
word
word
word
word
.
.
.

So my plan of attach was to use sed to replace the comma (,) with a newline like so:

sed 's/,/\n/g'

Which basically added a "n" where the comma was formerly. Any idea on how I can achieve my desired result? Thanks!