- Jun
- 760
- 16
I think that it is not clear that without the /V option, not only does the command display only the first match, it doesn't even look for all the matches. If one wants the variable
/V Find and display all matching text (FSEARCH defaults to only finding and displaying the first match in each file)
If one wants the count of total matches but does not want to see them all, one can add the /U option or redirect the output to nul.
_fsearch_matches
to have the number of total matches, the /V option is required. It might be better if the help for /V said something like the following:/V Find and display all matching text (FSEARCH defaults to only finding and displaying the first match in each file)
Code:
TCC(34.00.12): C:\temp>fsearch /t"line" junk.txt & echo Variable _fsearch_matches = %_fsearch_matches
---- C:\temp\junk.txt
Line 9
Matching lines: 1 Matching files: 1 Total files searched: 1
Variable _fsearch_matches = 1
If one wants the count of total matches but does not want to see them all, one can add the /U option or redirect the output to nul.
Code:
TCC(34.00.12): C:\temp>fsearch /t"line" /v junk.txt >nul & echo Variable _fsearch_matches = %_fsearch_matches
Variable _fsearch_matches = 9
TCC(34.00.12): C:\temp>fsearch /t"line" /u /v junk.txt & echo Variable _fsearch_matches = %_fsearch_matches
Matching lines: 9 Matching files: 1 Total files searched: 1
Variable _fsearch_matches = 9