Page 1 of 1
Support for Unix and Mac EOLs
Posted: 2012-03-16, 20:22 UTC
by umbra
Currently, when you want to search for a text containing EOL (either in the Lister or in the Find Files dialog), you are limited just to files with Windows EOL, because '\n' matches 'CRLF'. Properly, there should be '\r' for 'CR' and '\n' for 'LF'.
I would prefer this solution. However for a compatibility reason, it would also be acceptable, if there was no '\r', just '\n' like now, except it would match all three EOLs at the same time.
Posted: 2012-03-18, 16:12 UTC
by ghisler(Author)
You can just use the hex search. For example, to find the text "end." followed by \r, search for
"end." 0D
and check ther option "Hexadecimal".
Posted: 2012-03-18, 22:38 UTC
by umbra
That is not exactly intuitive. And how do you search for a text containing double quotes, like "text"\r in this example ('\r' represents a new line)?
Posted: 2012-03-19, 13:50 UTC
by ghisler(Author)
Just use the hex code for quotes (22).
Posted: 2012-03-19, 15:31 UTC
by umbra
That's what I was afraid of. To make a simple search in a text file, I would have to use a Hex search and remember several binary codes. I guess it's much simpler to use a different tool.
Posted: 2012-03-19, 17:17 UTC
by karlchen
Hello, Umbra.
Though I like your idea of having a really simple way of finding EOL without caring about Unix text file format vs Window text file format vs Mac text file format, I must admit that the codes to remember for the hex search are just 2:
+ 0D - carriage return
+ 0A - line feed
Unix uses: 0A only
Windows uses: 0D 0A
Mac uses: 0D only (at least they used to do so)
Cheers,
Karl
Posted: 2012-03-19, 17:31 UTC
by umbra
Hi, you've forgotten about double quotes - 0x22. So the search string for the simple example given in the 3rd post would be
And now try to imagine something a little bit more complex. As I said before, for other than Windows text files, it's easier to use something else than the Lister.
However, if this request doesn't have a broader support, I don't mind. Most of the time, I'm using external editors anyway.
Posted: 2012-03-19, 21:46 UTC
by karlchen
Hello, Umbra.
Right, the 3 hex values are only useful if you wish to locate the EOL sequence alone. Which is nonsense because you can simply see this on your screen without searching for it.
OK. In order to find let us say the word "packing" at the end of a line in lister proceed like this:
Press <Ctrl>-F. Type "packing$" without the double quotes. Tick the option Regex. Click OK.
Seems to work fine here.
Sample file used: T.C. history.txt (Windows CRLF) and history_lf.txt (Linux LF) and history_cr.txt (Mac CR).
Kind regards,
Karl
--
Total Commander 8.0ß23 32-bit