Add Comment
|
Related Links
|
TrackBack
sed won't produce new line on Mac OS XDiscovered a problem with 'sed' UNIX command on Mac OS X tonight. I want to use it to parse text and position new line characters in the right place in the sequence. But the 'sed' program that is on Mac OS X doen't work correctly. Instead of adding new line characters, it strips the backslash and output the 'n' character. The following is an example from the Mac OS X Terminal: $ echo "Hello World" | sed 's/World/\nWorld/' The same example works correctly on Ubuntu Linux: $ echo "Hello World" | sed 's/World/\nWorld/' Is there an alternative solution. I would like to get this to work on Mac OS X. For now, I can fall back to Ubuntu Linux, but it's more work. Anyone have a work-around? Chieh Cheng Same identical problem! Didi you sort it out? fabrizio Unfortunately, no. My only work-around now is to transfer the file to Ubuntu Linux, process it, and then transfer it back. :-( Chieh Cheng TRye this out: http://cafenate.wordpress.com/2010/12/05/newlines-in-sed-on- . . . $ echo 'foo bar baz quux' | sed -e 's/ /\'$'\n/g' zharik Thanks, zharik. It works on both Mac OS X and Ubuntu Linux. Chieh Cheng
Add Comment
|
Related Links
|
TrackBack
Did your message disappear? Read the Forums FAQ. TrackBackTrackBack only accepted from WebSite-X Suite web sites. Do not submit TrackBacks from other sites. Send Ping | TrackBack URL | Spam Control Title: egrep ignores begin of line on Mac OS X Add CommentSpam Control | * indicates required field Messages, files, and images copyright by respective owners. |
Articles
|
Wiki
100 Users Online
|
Copyright © 2004 - 2024. All Rights Reserved. |