![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| OS X (Apple) OS X is a line of Unix-based graphical operating systems developed, marketed, and sold by Apple. |
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 |
| replacing strings with newlines : sed | hkansal | Shell Programming and Scripting | 3 | 11-28-2008 01:24 PM |
| replacing comma's with newlines using sed | newbie_coder | Shell Programming and Scripting | 5 | 09-28-2008 11:44 PM |
| textfile into 2 pieces, seperate by newlines. | mcW | Shell Programming and Scripting | 12 | 09-24-2008 03:02 PM |
| Bash scripting question re: newlines | retrovertigo | Shell Programming and Scripting | 4 | 07-06-2007 12:44 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Add CRs (newlines)
I have a long file originally created with vi but at some point saved with MS Word. At another time I substituted all occurrences of ^M with XXX. Now I'd like to get this back to vi but with the XXX converted to newline.
I'm using whatever version of vim Apple employs. Thanks, Gale |
|
||||
|
I thought my original message was clear.
This is one long file in a single line. Wherever XXX appears I need a carriage return or newline so the file can be read and edited with vi. So I'm not just trying to get rid of XXX, I'm trying to REPLACE them with a carriage return. I originally screwed up this file after it had been saved in MS Word and of course there was a ^M everywhere. I used the substitute command in vi to get rid of those ^Ms but still didn't achieve the result I wanted. Then I substituted XXX for ^M with: :%s/^M/XXX/g |
|
||||
|
If you still have the original file with a ^M after each line you can remove them with:
Code:
tr -d '\r' < your_file > new_file |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|