Closed j256 closed 1 year ago
Thanks. Couple other comments:
perl -ne "open(OUT, q(>>), q(/path/to/new/file));binmode(OUT);print OUT s/\R/\012/r" /path/to/file
Maybe q(>) to match to the others?
piping the output like this generates an error: perl -pe "binmode(STDOUT);s/\R/\012/r" /path/to/file | set-content /path/to/new/file -Encoding Byte
When I quote code with an error I tend to put this into the code block to stop people from using it. So maybe:
:: this doesn't work
perl -pe "binmode(STDOUT);s/\R/\012/r" /path/to/file | set-content /path/to/new/file -Encoding Byte
Just to note, if you have more comments on a closed issue, open a new issue. In my filters to look at what I need to do, I don't include closed issues. I can re-open this, but that doesn't mean that doing the same thing later would get noticed.
This is about the following perl page. Thanks for it.
https://www.perl.com/article/53/2013/12/14/The-ultimate-guide-to-Windows-and-Unix-file-line-ending-conversion-in-Perl/
Things are very different when we talk about
perl -e 'binmode(STDOUT); print "\n";'
versusperl -e 'binmode(STDOUT); print "\n";' > x
. When the output is going to a file, I've not been able to disable binary mode withbinmode(STDOUT);
. Interestinglyperl -e 'binmode(STDOUT); print "\n";' | cat > x
works.