Quantcast
Channel: Change line feed of csv file to the same one - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Change line feed of csv file to the same one

$
0
0

I need to work with csv files. I want to write an web app which is working with csv files and is written in php. Problem is all the csv files have diffrent line feeds /r, /n,/r/n/. I need to have the same in all of them. Till now i do it like this:

exec("sed -i 's/\r$//' files/uploads/$fileName"); // DOS to Unix
exec("sed -i 's/$/\r/' files/uploads/$fileName"); // Unix to DOS

And in the end all of them have /r/n. But what if i get a csv file with /r as line feed, how to deal with that?

Thanks for your help


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images