By registering with us, you'll be able to discuss, share and private message with other members of our community.
SignUp Now!/grep=Type,IncludeLineNumbers,IncludeFilename,MatchCase,CountMatches,PatternType,UTF8,IgnoreEmpty,Pattern
thankAfter a search of the forum, I found this;
https://jpsoft.com/forums/threads/word-count-using-tpipe.5704/
Joe
That doesn't seem to count more than one match per line.After a search of the forum, I found this;
https://jpsoft.com/forums/threads/word-count-using-tpipe.5704/
Joe
v:\> echo foofoo | tpipe /grep=3,0,0,0,1,0,0,0,foo
1
v:\> echo foofoo^r^nfoo | tpipe /grep=3,0,0,0,1,0,0,0,foo
2
v:\> echo foofoo^r^nfoo | tpipe /replace=4,0,0,0,0,0,0,0,0,foo,foo\r\n /grep=3,0,0,0,0,0,0,0,foo
foo
foo
foo
v:\> echo foofoo^r^nfoo | tpipe /replace=4,0,0,0,0,0,0,0,0,foo,foo\r\n /grep=3,0,0,0,1,0,0,0,foo
3
type problems.txt
AsusACPIServer
AsusEPCMonitor
AsusTray
ETDWare
ETDWareDetect
ffind /l/v/t"Asus" problems.txt
---- C:\utils\problems.txt
[1] AsusACPIServer
[2] AsusEPCMonitor
[3] AsusTray
3 lines in 1 file
AsusACPIServer AsusACPIServer
AsusEPCMonitor
AsusTray
ETDWare
ETDWareDetect
StringCount=%@script[vbscript,Const ForReading = 1::set fso=CreateObject("Scripting.FileSystemObject"):set oFile = FSO.OpenTextFile("%1", ForReading):set stdout=fso.GetStandardStream(1):strContents = oFile.ReadAll:oFile.Close::Set rgxp = New Regexp:rgxp.Pattern = "%2":rgxp.IgnoreCase = False:rgxp.Global = True:Set matches = rgxp.Execute( strContents )::stdout.WriteLine matches.Count:]
Const ForReading = 1
set fso=CreateObject("Scripting.FileSystemObject")
set oFile = FSO.OpenTextFile("%1", ForReading)
set stdout=fso.GetStandardStream(1)
strContents = oFile.ReadAll
oFile.Close
Set rgxp = New Regexp
rgxp.Pattern = "%2"
rgxp.IgnoreCase = False
rgxp.Global = True
Set matches = rgxp.Execute( strContents )
stdout.WriteLine matches.Count
echo %@StringCount[problems.txt,Asus]
4
~\work> type x.txt [49] 0:00:00.020
C:\fixups\add_enlarge_picture_opti.user.js
C:\fixups\allow_fixups.user.js
C:\fixups\better_epguides.user.js
~\work> ffind /l /v /t"fixups" x.txt
---- C:\Users\DCantor\work\x.txt
[1] C:\fixups\add_enlarge_picture_opti.user.js
[2] C:\fixups\allow_fixups.user.js
[3] C:\fixups\better_epguides.user.js
3 lines in 1 file
~\work> ffind /l /v /t"fixups" /x x.txt
---- C:\Users\DCantor\work\x.txt
Offset: 3 (3h)
Offset: 47 (2fh)
Offset: 60 (3ch)
Offset: 79 (4fh)
4 lines in 1 file
~\work> echo %_ffind_matches
4
I'm trying the ffind command and I'm finding (no pun intended ...) that it automatically cuts off at 6 matches in one file. I'm trying to check a large file for > < and % and I've added a bunch of each. When I run ffind, for each character it only shows 6 lines. I deliberately added /-50 which means "stop counting after 50 occurrences" but it still stops after 6.If you only want the count, FFIND can be used by specifying /X, thus:
Seems OK here, though (far below) "24 lines" is misleading. It was actually 24 occurrences of "%" (in 7 lines).I'm trying the ffind command and I'm finding (no pun intended ...) that it automatically cuts off at 6 matches in one file. I'm trying to check a large file for > < and % and I've added a bunch of each. When I run ffind, for each character it only shows 6 lines. I deliberately added /-50 which means "stop counting after 50 occurrences" but it still stops after 6.
(Just to be clear: I'm running one search for >, a second search for %, and a third search for <. I did find that I can search for > or < with /t">" but for % I have to use /t"^%" That's not specified in the Help.)
v:\> ffind /t"^%" /v /x avtemp.btm
---- V:\avtemp.btm
Offset: 198 (c6h)
Offset: 204 (cch)
Offset: 578 (242h)
Offset: 587 (24bh)
Offset: 595 (253h)
Offset: 604 (25ch)
Offset: 617 (269h)
Offset: 626 (272h)
Offset: 633 (279h)
Offset: 642 (282h)
Offset: 661 (295h)
Offset: 668 (29ch)
Offset: 677 (2a5h)
Offset: 701 (2bdh)
Offset: 707 (2c3h)
Offset: 748 (2ech)
Offset: 777 (309h)
Offset: 784 (310h)
Offset: 790 (316h)
Offset: 800 (320h)
Offset: 817 (331h)
Offset: 824 (338h)
Offset: 852 (354h)
Offset: 859 (35bh)
24 lines in 1 file
v:\> echo %_ffind_matches
24