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!

sed carriage return

Status
Not open for further replies.

Mag0007

MIS
Feb 15, 2005
829
US
How do I get a return in sed?

trying replacing a space with carraige return
echo "hello mr" | sed -e 's/ /\n'

\n does not work.

 
first note: \n is a newline, not a carriage return...

is sed a requirement?

otherwise
Code:
tr ' ' '\n'

or if your sed supports the following:

Code:
sed 's/ /\   
/'

try googling for "sed newline"

HTH,

p5wizard
 
p5wizard:

thanks! no, sed is not required.

However your sed code does not work, I get a parse error.

And yes, I have been googling around, and found notihng.

If possible I can even use a perl one liner.

 
google for

sed newline faq

it should provide plenty of sed help

HTH,

p5wizard
 
add an / at the end:

echo "hello mr" | sed -e 's/ /\n[red]/[/red]'

Cheers.
 
something like this ?
echo "hello mr" | tr -s ' ' '\n'

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top