Link to home
Start Free TrialLog in
Avatar of NVIT
NVITFlag for United States of America

asked on

FindStr works only with 1 char searches

In a Windows 7 cmd window, I report on Windows Updates via:
wmic qfe list brief /format:csv>test_csv.csv

Open in new window


When I search test_csv.csv with findstr, it doesn't work with more than 1 char. But, when searched for a single character, it works and returns the string with SPACEs between each letter (I put periods for clarity):
findstr /r /i /c:"6" "test_csv.csv"
.D.H.3.4.G.S.W.1. .S.e.c.u.r.i.t.y. .U.p.d.a.t.e. .K.B.3.1.0.8.6.6.4. .N.T. .A.
..T.H.O.R.I.T.Y. .S.Y.S.T.E.M. .1. .1.3. .2.0.1.6.

Open in new window

Using notepad++ or Excel, I open test_csv.csv. It looks normal.

I thought changing the /format:csv switch to /format:texttablewsys would fix it. e.g.:
wmic qfe list brief /format:texttablewsys>test_text.txt

Open in new window


No joy.

In notepad++, I select all the text in test_csv.csv and save it to a new file.

Now, findstr works on multiple characters.

findstr /r /i /c:"2016" "test_csv_new.csv"

Open in new window


So, notepad++ is removing the invisible characters.

Is there a wmic switch to tell it to NOT put the invisible characters, e.g. change the character coding? Or, another way?
ASKER CERTIFIED SOLUTION
Avatar of regmigrant
regmigrant
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of NVIT

ASKER

Thanks, regmigrant!