Thursday, February 8, 2024

[SOLVED] How can I detect DOS line breaks in a file?

Issue

I have a bunch of files. Some are Unix line endings, many are DOS. I'd like to test each file to see if if is dos formatted, before I switch the line endings.

How would I do this? Is there a flag I can test for? Something similar?


Solution

You could search the string for \r\n. That's DOS style line ending.

EDIT: Take a look at this



Answered By - nc3b
Answer Checked By - Clifford M. (WPSolving Volunteer)