ffind hangs on large file

The command

ffind /t"xyz" Test.txt

hangs while using maximum cpu. The file Test.txt is 12,278,005 bytes, has only one line, and the string "xyz" does not occur in the file.

This problem is similar to

ffind /e hangs

but that problem involved a regular expression. Does /t have a limit on the length of lines?

TCC 26.00.31 x64 Windows 10 [Version 10.0.18363.752]
It may be 10x faster in many cases, but in my case, it is infinitely slower. In your Dec. 30, 2019, post, you recommended using /T for this use case; now my btm file is broken again. Hanging is not user friendly; an error message would be better. (I'll rewrite my btm.)
May 20, 2008
Syracuse, NY, USA
So what's the bottom line here? Should FFIND find be able to fail to find text in a single-line 12,000,000 MB file? Should it work or not? My attempt has been running for over 10 minutes, using all of one CPU; I can't interrupt it with Ctrl-C.


Staff member
May 14, 2008
I tried your file with v26:

[D:\TakeCommand26\TCConsole]timer & ffind /m/b/t"Page Not Found" playerlist13.htm & timer
Timer 1 on:  9:51:52a
Timer 1 off:  9:51:52a  Elapsed: 0:00:00.028


TCC  26.00.32 x64   Windows 10 [Version 10.0.19592.1001]


FFIND and LIST (which share most of their code) have been deprecated for some time now other than for simple cases. They were both written for 4DOS with a focus on small code, not fast code, and I will not be adding any new features to them (ever).

LIST was replaced with VIEW years ago; for any heavy / complex use TPIPE is a better solution than FFIND. I will probably write a new (much faster) replacement for FFIND for a future version of TCC.
Aug 9, 2009
i seem to remember that we were told by you that ffind should be used like so /m /b /t"text" some file , I dont see any spaces between the optional switches. I know it still works but some consistency along syntax forming should be followed by the author no?
My email used spaces between the switches. The problem is 100% reproducible for me, so I don't know why Rex can't reproduce it. Vince said he can reproduce it. Regardless, I've switched to Cygwin's grep, which does not have the problem with long lines that FFIND has when using /T"xx" and /E"xx".
May 20, 2008
Syracuse, NY, USA
I can no longer reproduce it with build 32. I've tried a 12 MB file (test.txt) of random ASCII printables (32-126) and a 12 MB concatenation of 538 copies of my ApplicationPrivateSettings.xml (big.xml), both files having no newlines.

When I ask it to find non-existent test, I get results like Rex's.

c:\users\vefatica\appdata\local\microsoft\visualstudio\16.0_6b6f020f> timer & ffind /m/b/t"Page Not Found" big.xml & timer
Timer 1 on: 11:55:40
Timer 1 off: 11:55:40  Elapsed: 0:00:00.021

v:\> timer & ffind /m/b/t"Page Not Found" test.txt & timer
Timer 1 on: 11:56:05
Timer 1 off: 11:56:05  Elapsed: 0:00:00.021

When I ask it to find test which does exist and with the "/b" option, it finds it quickly.

v:\> timer & ffind /m/b/t"X" test.txt & timer
Timer 1 on: 11:58:56
Timer 1 off: 11:58:56  Elapsed: 0:00:00.016

And for existing test without "/b" it immediately spits out the one line (all 12 MB).

My only gripe is that it takes 3+ minutes to spit out that line (TYPE takes 1.7 second) and it can't be interrrupted.

Except for the speed of output and the fact that it can't be interrupted, it seems to be working correctly.
May 20, 2008
Syracuse, NY, USA
In another test with existing text and without "/b", where the text is near the end of the file, it's fast but only spits out the last 6934 bytes of the file. That might be WAD ... beats rewinding to find out where the line began (?).

v:\> timer & ffind /m/t"n7g=17Sy)Bb4" test.txt | wc & timer
Timer 1 on: 12:13:10
      3      86    6934
Timer 1 off: 12:13:10  Elapsed: 0:00:00.193

The two extra lines reported by wc.exe are an empty line and the header "---- V:\test.txt".
May 20, 2008
Syracuse, NY, USA
Same as /E. If you do a /T that is not a reverse search, it is converted to a /E search (because it's 10x faster).
If you're going to do that you might massage the regex (search string) a bit (more) so Oniguruma doesn't choke on it (first below) or do the wrong thing (second below).

v:\> ffind /m/t"d:\tc26\1" sv.btm
TCC: invalid backref number/name "(?i)d:\tc26\1"

d:\tc26> ffind /m/t"d:\tc26" tcmd.ini

d:\tc26> ffind /m/t"d:\\tc26" tcmd.ini

---- D:\tc26\tcmd.ini


Staff member
May 14, 2008
In build 32, it works for my 12 megabyte file. But, it hangs for a file of size 25 megabytes.

If there are unexpected limitations like this, it would save time (and forum posts) if the Help mentioned it.

OK. FFIND will also not work with files > 128 yottabytes.

And regarding your file - it's not a 25Mb file that's a problem, it's a (somewhat ridiculous) 25Mb single line.
Thank you, but I've already switched to Cygwin's grep for this, so please don't do it on my account. A note in the Help that ffind expects line endings every so often would suffice. (Although, it would be friendlier if /e and /t errored when you exceed the buffer limit rather than hanging.)
Similar threads
Thread starter Title Forum Replies Date
D ffind /e hangs Support 7
J ffind does not find files Support 4
Alpengreis ffind dialog (/W) problem Support 4
vefatica FFIND, temp files? ... not deleted? Support 0
S FFIND text that includes " Support 7
vefatica FFIND needs work Support 12
Joe Caverly Multiple Text Searches at once using FFIND or TPIPE Support 4
Kachupp FFIND TPIPE Support 9
Gamegod ffind bug with chinese Support 2
vefatica FFIND and multi-line regular expressions Support 4
vefatica Make FFIND a bit more friendly? Support 14
M Trying to use ffind with a @file.lst doesn't work Support 4
vefatica Corruption from FFIND? Support 5
vefatica FFIND /S and System32? (and an OT mystery) Support 14
T FFind - can we display n number of lines after the find? Support 2
vefatica Help nit (FFIND and DIR with /S) Support 0
R ffind not setting %_ffind_ vars if /f is used Support 7
M FFIND wordA AND wordB Support 4
vefatica FFIND and _? Support 1
B Fixed FFIND doesn't find last character in file without CR/LF at EOF Support 1
dcantor How to make line numbers fixed width in FFIND Support 11
vefatica FFIND /S, find directory with specified name? Support 7
D Why doesn't ffind find directory? Support 3
C FFind /w works but FFind /= doesn't? Support 2
vefatica FFIND goes crazy Support 8
Stefano Piccardi TCC 13 vs. TCC 14 different FFIND /E"d$" output Support 1
Steve Pitts How to? FFIND, regular expressions and double quotes Support 4
vefatica FFIND /S in my profile directory Support 2
A How to? Pass output from ffind to another command in a BTM file Support 5
Phileosophos Can FFIND match file names with a regular expression? Support 19
vefatica FFIND and size ranges Support 1
R How to use ffind to find older files? Support 9
J How do I - ffind - with multiple items Support 10
M FFIND and LIST does not work for UTF-8 fles Support 10
L FFIND no result display Support 10
H Directory wildcards not working with ffind Support 3
D ffind and directories Support 2
Stefano Piccardi detecting BOM, FFIND multibyte regex Support 18
dcantor FFIND syntax -- is /E"regex" /X supported? Support 2
S FFIND and quoted strings Support 4
S FFIND /E"reg exp" : not case insensitive Support 4
J Problem with FFIND Support 1
J History file load hangs if file has complete garbage in it... Support 1
samintz CDD to non-existent directory hangs Support 2
krischik Take Command opens with (almost) white screen and then hangs Support 3
A v25.00.10 hangs when returning %_ipdnsserver Support 7
A After update to 24.02.49, helpfile tcmd.chm hangs when opened Support 0
vefatica gcd() ... wrong answer, lcm() hangs Support 5
rps Unalias * hangs TCC session Support 2

Similar threads