Re: Handling files with CRLF line ending

2022-12-08 Thread Chris Elvidge
On 08/12/2022 19:34, Ángel wrote: On 2022-12-07 at 12:38 +, Chris Elvidge wrote: I don't use Python generally, but my understanding of it (only a quick test) f = open("demofile2.txt", "a") f.write("Now the file has more content!") f.close() f.write doesn't append either \r\n or \n unless s

Re: Handling files with CRLF line ending

2022-12-08 Thread Ángel
On 2022-12-07 at 12:38 +, Chris Elvidge wrote: > I don't use Python generally, but my understanding of it (only a > quick test) > > f = open("demofile2.txt", "a") > f.write("Now the file has more content!") > f.close() > > f.write doesn't append either \r\n or \n unless specified. > > f.writ

Re: Handling files with CRLF line ending

2022-12-07 Thread Chris Elvidge
On 06/12/2022 23:39, L A Walsh wrote: On 2022/12/06 10:57, Chris Elvidge wrote: Yair, how about using the Python installed in the WSL instance. --- Oh, I wondered why Python used CRLF, but nothing else did. What version of python are you using? The Python for WSL, the python for cygwi

Re: Handling files with CRLF line ending

2022-12-06 Thread Koichi Murase
2022年12月7日(水) 8:40 L A Walsh : > [...] Similarly w/bash -- > I haven't tested it, but I'd expect bash compiled for windows > (using mingw toolchain) to use CRLF, but LF for WSL or Cygwin. I think there is actually no Bash compiled for Windows (i.e., the pure Windows API on the Windows subsystem).

Re: Handling files with CRLF line ending

2022-12-06 Thread L A Walsh
On 2022/12/06 10:57, Chris Elvidge wrote: Yair, how about using the Python installed in the WSL instance. --- Oh, I wondered why Python used CRLF, but nothing else did. What version of python are you using? The Python for WSL, the python for cygwin, or the python for Windows? If you

Re: Handling files with CRLF line ending

2022-12-06 Thread Chris Elvidge
On 06/12/2022 16:00, Dale R. Worley wrote: It seems to me that there's more going on than first meets the eye. Yes. Yair is trying to process text files written on a Windows system (line ending \r\n) on a Linux system (line ending \n). That Python wrote them is neither here nor there. Windo

Re: Handling files with CRLF line ending

2022-12-06 Thread Dale R. Worley
It seems to me that there's more going on than first meets the eye. My understanding is that Posix's file open function allows specifying if the file is text or binary, and in text mode, if the underlying system natively uses CRLF for EOL, CRLF in the file is turned into LF for the code in a trans

Re: Handling files with CRLF line ending

2022-12-06 Thread Yair Lenga
Valid question. I believe a major goal of bash will be to cross operate with other tools. In this case, being able to read text files generated by python, when running under WSL, seems like something bash should do. On the question of minimal changes. I believe many bash users (some are not hard

Re: Handling files with CRLF line ending

2022-12-05 Thread Chet Ramey
On 12/3/22 8:53 AM, Yair Lenga wrote: Thank you for suggestions. I want to emphasize: I do not need help in striping the CR from the input files - it's simple. The challenge is executing a working bash/python solution from Linux on WSL, with MINIMAL changes to the scripts. That's certainly you

Re: Handling files with CRLF line ending

2022-12-03 Thread Yair Lenga
Thank you for suggestions. I want to emphasize: I do not need help in striping the CR from the input files - it's simple. The challenge is executing a working bash/python solution from Linux on WSL, with MINIMAL changes to the scripts. Specifically in my case, the owners of the various modules ar

Re: Handling files with CRLF line ending

2022-12-03 Thread Greg Wooledge
On Sat, Dec 03, 2022 at 05:40:02AM -0500, Yair Lenga wrote: > I was recently asked to deploy a bash/python based solution to windows > (WSL2). The solution was developed on Linux. Bash is being used as a glue > to connect the python based data processing (pipes, files, ...). Everything > works as