Welcome!

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

SignUp Now!

Multiple Text Searches at once using FFIND or TPIPE

Aug
1,948
71
Code:
     _x64: 1
   _admin: 1
_elevated: 1

TCC  25.00.11 x64   Windows 10 [Version 10.0.18362.239]
OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.18362 N/A Build 18362

The Microsoft FindStr command allows me to do multiple searches for text at once;
Code:
e:\utils>systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.18362 N/A Build 18362

Is this possible using either FFind or TPipe? I have tried the following;
Code:
e:\utils>systeminfo | ffind /kvm /t"OS Name" /t"OS Version"
OS Version:                10.0.18362 N/A Build 18362
BIOS Version:              Dell Inc. A18, 2018-11-14

e:\utils>systeminfo | tpipe /grep=3,0,0,0,0,0,0,0,"OS Name" /grep=3,0,0,0,0,0,0,0,"OS Version"

...but did not get the desired results.

Joe
 
I think FFIND will only take one /t parameter (from your example it looks to use the last one on the line) and TPIPE filters are sequential, so the output of the first grep filter in your example is used as the input to the second one, hence the reason nothing matches.

The only way I can think of doing it in TCC is with a regular expression. I had to look at the help to see if FFIND supports them, and it doesn't seem to, but TPIPE does. So your example search could be done like this for example:

Code:
d:\>systeminfo | tpipe /grep=3,0,0,0,0,0,0,0,"\bOS [NV]"
OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.18362 N/A Build 18362
 
FFIND and TPIPE do not support multiple simultaneous searches.

FFIND does support regular expressions (with the /E"..." option).
I don't know how I missed that /E option when I looked at the help...

So Joe could do this with FFIND (assuming the TCC default escape character):
Code:
d:\>systeminfo | ffind /k /m /v /e"^^OS [NV]"
OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.18362 N/A Build 18362
 
You should be able to "OR" several regular expressions with either FFIND /E or TPIPE's grep ...

Code:
v:\> systeminfo | FFIND /k /m /v /E"OS Name|OS Version"
OS Name:                   Microsoft Windows 10 Pro for Workstations
OS Version:                10.0.18362 N/A Build 18362
BIOS Version:              Dell Inc. 1.1.6, 2018-12-14

Get rid of the unwanted one with a BOL indicator.

Code:
v:\> systeminfo | FFIND /k /m /v /E"^OS Name|^OS Version"
OS Name:                   Microsoft Windows 10 Pro for Workstations
OS Version:                10.0.18362 N/A Build 18362
 

Similar threads

Back
Top