CSV description line breaks


I have a script writing to a csv file and there are line breaks in the file, the client said he wants it all to be in one line. Is there a way to make it so the script makes it on one line but it still has the breaks?


$description = "
The following is a list of options as this 300E is currently

    - 3.0L  6-Cyl.

    - 4 Speed
Automatic Transmission

    - 4 Wheel Disc
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

Ricky MartireIT Design ArchitectCommented:
Yes, make the output use '\r\n' on the same line, this will ensure that the CSV outputs all on one line but when its imported at the other end it will put the line breaks back in.

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
Dave BaldwinFixer of ProblemsCommented:
Since &nbsp; only works in HTML, replace the line breaks with <br> which is an HTML line break.
movieprodwAuthor Commented:
yes but how to I str replace them? I do not know what character is making the line break
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Dave BaldwinFixer of ProblemsCommented:
You will have to examine the text.  It could be any combination of CR's and LF's.
Ray PaseurCommented:
If you can post a few samples of the data and show us what you want to change it into, I am fairly sure we can help.
movieprodwAuthor Commented:
Thanks guys, I just removed all returns and the client was happy.
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

From novice to tech pro — start learning today.