Fixed FFIND doesn't find last character in file without CR/LF at EOF

Jun 2, 2008
TCC 18.00.30 x64 Windows 7 [Version 6.1.7601]
TCC Build 30 Windows 7 Build 7601 Service Pack 1

Using swedish keyboard and Regional and Language Options: Swedish

Counting occurrences in an Unicode/ANSI file with FFIND is incorrect if character/word is at end of file (on last line) and file doesn't end with cr/lf.
With cr/lf at eof the counting is correct.

Example 1:
Create an Unicode or ANSI file containing 1 line with letter A.
Add a CR/LF at end of file and close the file.
File should be 3 character long in ANSI or 8 character long in Unicode with BOM.
FFIND /t"A" /v fileName returns "1 line in 1 file" ==> Correct.

Test data:
41 0d 0a (Uppercase A) ANSI
ff fe 41 00 0d 00 0a 00 (Uppercase A) Unicode with BOM
[C:\]ffind /t"A" /v fileName

---- C:\Temp\fileName

1 line in 1 file

Example 2:
Create an Unicode or ANSI file containing 1 line with letter A.
Close the file.
File should be 1 character long in ANSI or 4 character long in Unicode with BOM.
FFIND /t"A" /v filename returns nothing ==> Incorrect.

Test data:
41 (Uppercase A) ANSI
ff fe 41 00 (Uppercase A) Unicode with BOM
ffind /t"A" /v 1
[C:\]ffind /t"A" /v fileName

---- C:\Temp\fileName

Reproducible: Always.

Best regard
Berndt Berg


Staff member
May 14, 2008
Like LIST (with which it shares most of its code), FFIND is (1) slow, and (2) obsolete. LIST has been replaced by VIEW, and FFIND has been replaced by TPIPE.

FFIND (like LIST) has always been line based. If you don't have a CR/LF (or at least a LF), you don't have a line.
Similar threads
Thread starter Title Forum Replies Date
D Why doesn't ffind find directory? Support 3
M Trying to use ffind with a @file.lst doesn't work Support 4
C FFind /w works but FFind /= doesn't? Support 2
J ffind does not find files Support 4
D ffind hangs on large file Support 18
Alpengreis ffind dialog (/W) problem Support 4
vefatica FFIND, temp files? ... not deleted? Support 0
S FFIND text that includes " Support 7
D ffind /e hangs 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
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
dcantor How to make line numbers fixed width in FFIND Support 11
vefatica FFIND /S, find directory with specified name? Support 7
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
vefatica Setting array variable ignores leading spaces (and @execarray doesn't) Support 4
MickeyF Why doesn't my python program get executed without specifying its path? Support 2
gworley Virtual network drive filename completion doesn’t get directories Support 0
vefatica Win10's ANSI doesn't like 2>NUL Support 10
vefatica Win10, alternative screen buffer, cursor doesn't blink Support 11
Charles Dye Ctrl-Shift-Up doesn't update directory history Support 1
gschizas Take Command (Environment) doesn't show v2 ANSI colors Support 30

Similar threads