find/replace special characters

How can I find/relace carrage returns in a text document.  Currently I use both sed and vi to find and replace text:
$sed s/findme/replacewith/g filename > filename.ver2
or in vi I use:

but return charaters seem to be tricky to recognize this way?!

Thanks in advance
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

In your sed statement, try a cntrl-v before you put in the carrage return.  this is similar to a \ in programming.  You may have to find out which other cntrl character it may be depending on what flavor of Unix you are running, but this should work.  Good Luck

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
You can do it much simpler, by means of command "tr".
"tr" may use octal ascii-numbers instead of normal characters.
newline has ascii-value 10, which is "12" in octal representation.
If you want to replace alle the newlines in a file with, for instance, "&", the command is:

cat <filename> | tr "\12" "\46" > <newfile>

(the "&" has octal ascii value "46")

To print the octal and hexadecimal tables, try:  man ascii

good luck  ;)
that will work as well...I don't know if it's really "much simpler", but whatever works...Good luck
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.