Page 1 of 1
With the ES Comand line tool, how do I use '-' as part of the search?
Posted: Thu Mar 14, 2024 9:20 pm
by Ralf_Reddings
For example, if I had a file with a dash in its name,
cat - 5.png, I have tried the following calls to find it:
Code: Select all
ES -match-path -max-results 5 cat - 5 .png
ES -Gmatch-path -max-results 5 "cat - 5" .png
ES -match-path -max-results 5 cat "-" 5 .png
ES -match-path -max-results 5 cat '-' 5 .png
ES -match-path -max-results 5 cat '^-' 5 .png
But each call fails with an error, with the help for ES being printed. I am using latest Everything 1.5
Thanks for any help
Re: With the ES Comand line tool, how do I use '-' as part of the search?
Posted: Thu Mar 14, 2024 10:22 pm
by void
Powershell is removing the double quotes.
ES uses double quotes to escape command line options.
Please try the following with powershell:
Code: Select all
ES -match-path -max-results 5 cat '"-"' 5 .png
ES -match-path -max-results 5 "cat - 5" .png
I have put on my TODO list to treat a single dash (-) as literal.
Re: With the ES Comand line tool, how do I use '-' as part of the search?
Posted: Fri Mar 15, 2024 3:15 pm
by Ralf_Reddings
Thanks for the answer void. I tried
ES -match-path -max-results 5 cat '"-"' 5 .png
but it did not work. I can confirm that
ES -match-path -max-results 5 "cat [list]5" .png
worked but I think this will prove difficult for me to use in my PowerShell module (7.4)[/list]
I followed your example and discovered the following also work:
Code: Select all
ES xx "" - "
ES xx '- '
ES xx ' -'
ES xx "- "
ES xx " -"
Looking forward to the much anticipated ES update
Re: With the ES Comand line tool, how do I use '-' as part of the search?
Posted: Fri Mar 15, 2024 3:57 pm
by therube
Why didn't this one work for you (from a CMD prompt)?
ES -match-path -max-results 5 cat "-" 5 .png
It should, shouldn't it?
Re: With the ES Comand line tool, how do I use '-' as part of the search?
Posted: Fri Mar 15, 2024 6:08 pm
by Ralf_Reddings
Okay, I take back my words. I have yet to find a complete solution for using "-" as part of the search. If there are three files like so:
Code: Select all
C:\dogs\dogs [list]man.png[/list]
C:\dogs\dogs -man.png`
C:\dogs\dogs[list]man.png`[/list]
ES -match-path dogs ' -' man
finds:
Code: Select all
C:\dogs\dogs - man.png
C:\dogs\dogs -man.png`
but does not find
C:\dogs\dogs -man.png
On the other hand
ES -match-path dogs '- ' man
finds:
Code: Select all
C:\dogs\dogs - man.png
C:\dogs\dogs- man.png
but does not find
C:\dogs\dogs -man.png
I also tried
ES -match-path dogs `<'- '`|' -'`>man
("`" is for Powershell escaping ) and nothing gets returned.
Perhaps I can create a bookmark, use its macro to insert a literal
-
in the ES search, I will try that and see.
Also does anyone know if ES supports the 1.5 pre-processor features? Perhaps wrapping a pre-processor replacement into a bookmark macro might do it. I have never used them but this might be an ideal use case.
@therube
I am targeting PowerShell, I really would not know where to begin with CMD (I never touch it...)
Re: With the ES Comand line tool, how do I use '-' as part of the search?
Posted: Fri Mar 15, 2024 10:44 pm
by void
ES-1.1.0.28
- Treat a single - as literal instead of as an invalid switch.
Please also try the following to escape a dash (-)
"-:"
-or-
"-:"
Character Entities
Please also try the following to escape a dash (-)
(easier to do from the command line / powershell)
[char:45]
-or-
[char:0x2d]
[char:]
Re: With the ES Comand line tool, how do I use '-' as part of the search?
Posted: Sat Mar 16, 2024 10:31 am
by Ralf_Reddings
This was a life saver update. Thank you void!