Multiple string search

March 10, 2010 at 20:33:10
Specs: Windows XP, Vista
Hello,

I am in need of a script that does the following:

I have a master list that consists of thousands of entrys. It is tab delimited for 3 columns Part Numbers-quantity-cost
ie.
ABK008-14 5 7.50
ABK011-14 5 7.50
ABK012-14 0 7.50
ABK032-14 5 7.50
ABK034-14 3 7.50
ABK2202-14 5 7.50
ABK2203-14 5 7.50


I have a few is the part numbers I care about. I need to parse the master list and pull out all 3 columns that have to do with the part numbers i only need.


See More: Multiple string search

Report •

#1
March 10, 2010 at 20:50:45
How many items are you after? If it isn't too many you
could use findstr. Here is a quick example:

findstr /b "ABK011-14 ABK012-14 ABK032-14 ABK034-14" "yourfilename"


Report •

#2
March 10, 2010 at 21:00:43
I have 16 part number items.

Report •

#3
March 10, 2010 at 21:27:00
It will make for a long line but it should work ok.

findstr /b "part#1 part#2 part#3 part#4 part#5 part#6 part#7 part#8 part#9 part#10 part#11 part#12 part#13 part#14 part#15 part#16" "yourfile"


Report •

Related Solutions

#4
March 10, 2010 at 21:35:53
Works perfectly, Thank you!!!

Report •

#5
March 10, 2010 at 21:46:04
findstr also supports file-input of the strings to search for:
findstr /g textfile
which can be really handy sometimes.

Report •

#6
March 10, 2010 at 21:56:11
Good point nbrane, would you believe I glossed over the help page before posting and missed it? It always seems to be the way with switches I haven't used before. Just gave it a test and "/" will even take from a pipe.

Report •

#7
March 10, 2010 at 22:05:19
I just tried the new method that nbrane mentioned and received this error
(C:\inventory>findstr /g:searchinv.txt /f:inv.txt 1>results.txt
FINDSTR: Search string too long.)

I will stick with the way that works. Thank you Judago!


Report •

Ask Question