The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Newlines in shell variables narcvs Shell Programming and Scripting 5 03-26-2009 02:54 AM
textfile into 2 pieces, seperate by newlines. mcW Shell Programming and Scripting 12 09-24-2008 04:02 PM
replacing using sed shailesh_arya Shell Programming and Scripting 2 07-11-2008 01:06 AM
Bash scripting question re: newlines retrovertigo Shell Programming and Scripting 4 07-06-2007 01:44 PM
Counting characters between comma's dbrundrett Shell Programming and Scripting 2 03-19-2004 09:56 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 09-28-2008
newbie_coder newbie_coder is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 4
replacing comma's with newlines using sed

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?

Thanks in advance!
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:36 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0