On Windows, how can I detect the ending of a file line?

I saw answers to questions, but these answers are not in terms of windows from what I can say.

Windows uses CR LF, Unix uses LF, Mac uses LF, and classic mac uses something else. I don’t have the brain power to say that somehow, if the file uses a different line ending with what I type, I get errors when trying to run a script / program that, frankly, does not make much sense. After the conversion, the script works just fine.

Is it necessary in any case to pre-check which lines end with a file in Windows?

+6
source share
2 answers

Steps:

Then you can do:

c:\gnuwin32\bin\file.exe my-lf-file.txt

my-lf-file.txt; ASCII text

c:\gnuwin32\bin\file.exe my-crlf-file.txt

my-CRLF-file.txt; ASCII text with CRLF line delimiters

Of course, you can add c:\gnuwin32\binto yours %PATH%to have access to it without indicating the full path.


UPDATE:

  • If you have it installed gityou can start git-bashand run the command filefrom there.

  • Or you can install this subsystem as described in the official Microsoft documentation and gain access to the team file.

0

"" Windows. 2 VB .

"" Notepad++. .

, 7.5.6 enter image description here

Hex .

Powershell "True" Windows "False" * nix.

(Get-Content '\\FILESERVER0001\Fshares\NETwork Shares\20181206179900.TXT' -Raw) -match "\r\n$" 

: fooobar.com/questions/11424514/...

0

All Articles