searching path in files

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Blisk
New Member
New Member
Posts: 1
Joined: 2021-12-23, 16:31 UTC

searching path in files

Post by *Blisk »

I want to search a path instead of word in section search word
for example C:\windows\system32
when I want to search that in my files I always get nothing even when I create test.txt and put a C:\windows\system32 in it.
it doesn't find that string in test.txt
User avatar
sqa_wizard
Power Member
Power Member
Posts: 3854
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Re: searching path in files

Post by *sqa_wizard »

No problem here.
Text "C:\windows\system32" is found in test.txt

- All fields empty
- Find Text= C:\windows\system32
[x] ANSI charset (Windows)
[x] Unicode UTF-16
#5767 Personal license
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: searching path in files

Post by *petermad »

Try and search for the text C:\\windows\\system32 in stead

your example C:\windows\system32 actually will be found but something like c:\newcastle or c:\tivoli will not because TC treats \n as newline and \t as a tab.

So \n has to be changed to \\n and \t to \\t
Last edited by petermad on 2021-12-23, 17:16 UTC, edited 1 time in total.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: searching path in files

Post by *Dalai »

To find backslashes regardless of where they appear, they need to be doubled. I.e.

Code: Select all

C:\\windows\\system32
That's also stated in TC's help:
Find text
If this option is checked, you can enter text to be searched. With \t you find tabstops, and with \n line breaks (ENTER) in texts. To find a backslash \, you need to give it twice: \\ .
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
Gral
Power Member
Power Member
Posts: 1460
Joined: 2005-01-26, 15:12 UTC

Re: searching path in files

Post by *Gral »

petermad wrote: 2021-12-23, 17:09 UTC Try and search for the text C:\\windows\\system32 in stead

your example C:\windows\system32 actually will be found but something like c:\newcastle or c:\tivoli will not because TC treats \n as newline and \t as a tab.

So \n has to be changed to \\n and \t to \\t
Surprisingly search for \n does't works that way. I can find \n always. Search for \t works as expected. Also: for find "\t" (NOT tab) it's enough to search for uppercase - "\T" with search case sensitive disabled.
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: searching path in files

Post by *petermad »

Help wrote:To find a backslash \, you need to give it twice: \\ .
I know it says so in the help, but I have no trouble finding \ as long as it is not followed by n or t - I testet all the way back to TC 6.55 and that version can also find C:\windows\system32 in a text file by entering C:\windows\system32 in the "Find text" field.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: searching path in files

Post by *petermad »

2Gral
I can find \n always.
Not if you have a file with only one line.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
Gral
Power Member
Power Member
Posts: 1460
Joined: 2005-01-26, 15:12 UTC

Re: searching path in files

Post by *Gral »

2 petermad
Right.
User avatar
Gral
Power Member
Power Member
Posts: 1460
Joined: 2005-01-26, 15:12 UTC

Re: searching path in files

Post by *Gral »

Anyway i think search should work different way - in three modes:
1. Normal - \t \n \ search for these explicit strings
2. Extended - \t \n search for tabs and newlines respectively
3. Regular expressions

Notepad++ text editor works exactly this way.
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: searching path in files

Post by *petermad »

As I wrote earlier searching for \ inside text files works fine, but if I want to search for \\ I need to enter \\\ in the "Find text" field.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
p.tingen
Junior Member
Junior Member
Posts: 22
Joined: 2007-09-25, 05:52 UTC
Location: Netherlands

Re: searching path in files

Post by *p.tingen »

This hit me today as well. I was searching for the literal string "{protools\ttFile.i}" but found nothing.
Searching for "{protools\" gave results, including files that contained "{protools\ttFile.i}"

I set these options:
- All fields empty
[x] ANSI charset (Windows)

And according to suggestions above, I tried searching both with single and double backslashes and lower and capital T:
- Find text: protools\ttFile.i
- Find text: protools\TtFile.i
- Find text: protools\\ttFile.i
- Find text: protools\\TtFile.i

But all to no avail.

It looks as if TC keeps treating \t as tab, which is confusing and counter-intuitive. I agree with @Gral that the three modes he/she describes would be much clearer.
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: searching path in files

Post by *Dalai »

2p.tingen
Try with three or four backslashes.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: searching path in files

Post by *Stefan2 »

For to find Text {protools\ttFile.i}"
Search for: {protools\\ttFile.i}


or
Search first for: {protools\
and next for ttFile.i}
with "[x]F2 Search in found files" enabled



or
Search for: {protools.ttFile.i}
with "[x]RegEx (2)" enabled





HTH? :D
 
Post Reply