Support for Unix and Mac EOLs

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
umbra
Power Member
Power Member
Posts: 876
Joined: 2012-01-14, 20:41 UTC

Support for Unix and Mac EOLs

Post 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.
Windows 10 Pro x64, Windows 11 Pro x64
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50873
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post 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".
Author of Total Commander
https://www.ghisler.com
umbra
Power Member
Power Member
Posts: 876
Joined: 2012-01-14, 20:41 UTC

Post 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)?

Code: Select all

some text\r
another "text"\r
end
Windows 10 Pro x64, Windows 11 Pro x64
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50873
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Just use the hex code for quotes (22).
Author of Total Commander
https://www.ghisler.com
umbra
Power Member
Power Member
Posts: 876
Joined: 2012-01-14, 20:41 UTC

Post 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.
Windows 10 Pro x64, Windows 11 Pro x64
User avatar
karlchen
Power Member
Power Member
Posts: 4605
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post 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
MX Linux 21.3 64-bit xfce, Total Commander 11.50 64-bit
The people of Alderaan keep on bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine.
The Prophet's Song
umbra
Power Member
Power Member
Posts: 876
Joined: 2012-01-14, 20:41 UTC

Post 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

Code: Select all

22"text"220D
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.
Windows 10 Pro x64, Windows 11 Pro x64
User avatar
karlchen
Power Member
Power Member
Posts: 4605
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post 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
MX Linux 21.3 64-bit xfce, Total Commander 11.50 64-bit
The people of Alderaan keep on bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine.
The Prophet's Song
Post Reply