Here’s what I’m trying to do:
- using cmd.exe, go to a mounted windows network drive
- there is a hierarchy of folders in the starting directory with .doc files in them in which I want to search for a string that starts with “CCMPD” and then has unique numbers after that (defect numbers).
- The hierarchy is not consistent, that is, some folders have the .doc at the first level, others have some more folders under them where the doc is.
- Output each matching line to a file.
I came up with the command line command:
findstr /S “CCMPD” *.doc > D:\Data\FIND.txt
That actually works (I’m pretty proud of that) but the file is filled with the garbage that lives in a Word doc, and I can’t figure out how to filter it out. I can’t even paste the output in here because they’re not printable characters but you have probably all seen them before.
How can I create a find command that can filter out the Word garbage and output to an easily readable file?
try using the Strings tool. This will extract out the strings and get rid of the garbage.