|Don't ask to ask, just ask|
Re^5: Regular expressions across multiple linesby afoken (Canon)
|on Apr 26, 2016 at 05:29 UTC||Need Help??|
Just for completeness:
4) I don't know how these test cases were generated.
The windows text file was generated using the Notepad application on Windows 7, on a Samba share mapped as drive H: from a Slackware Linux 14.1 server. The Linux file was generated using joe on the Linux server. The old mac file was generated by using Notepad++ on the Windows machine (I have no old Mac). Re^5: Regular expressions across multiple lines shows the hexdumps of the files.
There is no way to do that without being in Perl bin mode or writing a C program.
With my setup, there is a way to generate all three files on Linux, without using binmode. This trick abuses the fact that there is absolutely no difference between text mode and binary mode on unix:
This won't work on Windows, because for C and Perl on Windows, \n and \x0A are equal. Then, text mode translation happens and every \x0A is replaced with CRLF. Running the same script on Windows (again using the Samba share) will complain about a missing "file" utility and gives this result:
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)