Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

FFIND text that includes "

Jun
11
0
How can I use FFIND to search files if I want to specify text that includes embedded double quotes? I want to find all lines that include "enum" including the double quotes. For example, the following isn't giving me what I want:

ffind /L /L5 /T"enum" /V *.json > c:\work\enum.txt

I've tried two, three and four double quotes on either side of enum. For example, ffind /L /L5 /T"""enum""" /V *.json > c:\work\enum.txt doesn't match anything.

However, if I use the /W dialog and enter "enum" for text, it seems to produce the correct matching lines. So, how do I do that on the command line? I need the /L5 but don't see how to do that in the dialog.

Thanks,
Sal
 
Code:
v:\> echo "foo"^r^nfoo
"foo"
foo

v:\> echo "foo"^r^n | ffind /kmvt"^qfoo^q"
"foo"

v:\>
 
Code:
v:\> echo "foo"^r^nfoo
"foo"
foo

v:\> echo "foo"^r^n | ffind /kmvt"^qfoo^q"
"foo"

v:\>
I'm curious about how to do the same with a regular expression (FFIND /E). Does anyone know how?
 
I'm curious about how to do the same with a regular expression (FFIND /E). Does anyone know how?

Code:
d:\temp>type foo.txt
foo
"foo"
Barney McGrew
Cuthbert
Dibble
Grub

d:\temp>ffind /kmve\"foo\" foo.txt
"foo"

d:\temp>echo "foo"^r^n | ffind /kmve\"foo\"
"foo"
 
Thanks, RogerB. But what if the regular expression contains a space? Then you'd need quotes for TCC also and the obvious doesn't work.

Code:
v:\> echo "1 2 3"^r^n1 2 3
"1 2 3"
1 2 3

v:\> echo "1 2 3"^r^n1 2 3 | ffind /kmve"\"1 2 3\""

v:\>
 
Of these examples, the use of ^q works. The use of \" produces different results, because it includes matches of \", which is common in JSON files and used to escape a double quote :). These are false matches in my use case.

Here is what works:

ffind /LL5VT"^qenum^q" js:*.json > c:\work\enum.txt

The match results are also the same as that which is produced using the dialog. Thus, conclusion is that ^q is the solution.

Where is the ^q documented?

Thanks!
 
Thanks, RogerB. But what if the regular expression contains a space? Then you'd need quotes for TCC also and the obvious doesn't work.

Despite what it says in the help, using quotes doesn't seem to be necessary in regular expression searches...

Code:
d:\temp>type foo.txt
foo
"foo"
Barney McGrew
"Barney McGrew"
Cuthbert
Dibble
Grub

d:\temp>ffind /kmveBarney McGrew foo.txt
Barney McGrew
"Barney McGrew"

d:\temp>ffind /kmve\"Barney McGrew\" foo.txt
"Barney McGrew"

d:\temp>echo "1 2 3"^r^n1 2 3 | ffind /kmve\"1 2 3\"
"1 2 3"

... although it wouldn't surprise me if a use case turns up where it doesn't work.
 
Of these examples, the use of ^q works. The use of \" produces different results, because it includes matches of \", which is common in JSON files and used to escape a double quote :). These are false matches in my use case.

Did you spot that the examples using the \" are regular expression searches (i.e ffind /e, and not ffind /t)? If you did test it with /e then apologies.

Where is the ^q documented?


If you look in the help under TCC > Command Line > Escape Character you'll find this:
Code:
Codes for Escape Characters

b backspace
c comma ,
e the ASCII ESC character (code 27)
f form feed
k back quote `
n line feed
q double quote "
r carriage return
s space
t horizontal tab character
 

Similar threads

Back
Top