Smart questions
Smart answers
Smart people
Join Tek-Tips Forums
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Mag0007 (MIS) (OP)
24 May 05 8:47
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.

p5wizard (IS/IT--Management)
24 May 05 9:04
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

Mag0007 (MIS) (OP)
24 May 05 9:14
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.

p5wizard (IS/IT--Management)
24 May 05 9:36
google for

 sed newline faq

it should provide plenty of sed help

HTH,

p5wizard

Chacalinc (Vendor)
24 May 05 9:42
add an / at the end:

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

Cheers.
PHV (MIS)
24 May 05 9:50
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

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close