Hi All,
silly question that I'm sure is easy to answer for a more experienced coder...
I have a file called test.txt containing the following text...
need, to, break, this, line, into, individual, lines
using sed, I'd like to make the file look like this...
need
to
break
this
line
into
individual
lines
here's the code I've tried
#!/bin/ksh
sed "s/,/\n/" test.txt > test.new.txt
but it returns the following in test.new.txt
Addn this, line, after, every, line, with, WORD
so, my questions are...
1.) how can I make sed replace all instances of "," in a given line?
2.) how can I make sed insert newline characters instead of just the character n?
d@DeCobox-Micro ~
$ cat unix
need, to, break, this, line, into, individual, lines
$ cat unix |sed 's/\,/\n/g'
need
to
break
this
line
into
individual
lines
d@DeCobox-Micro ~
$ cat unix |tr "," "\n"
need
to
break
this
line
into
individual
lines
d@DeCobox-Micro ~
$ cat unix |tr "," "\n" |tr -d "^ "
need
to
break
this
line
into
individual
lines