Solved How use findstr to find exact numbers in txt file?

February 15, 2014 at 11:43:18
Specs: Windows 7
contents of j.txt:

g:\win\pcs\n\a.jpg 21812
g:\win\pcs\n\n10.jpg 2181203
g:\win\pcs\n\n12.jpg 321812
g:\win\pcs\n\b.jpg 21812
g:\win\pcs\n\n20.jpg 2181222
g:\win\pcs\n\n21.jpg 98221812

I want to use findstr to output any line that have the exact numbers 21812.
So from the file above only the lines with the files a.jpg and b.jpg should be outputted.

I have used findstr /e 21812 >>s.txt
I have used findstr /l 21812 >>s.txt

Both seem to print lines that have similar matches. I need lines that only have 21812, not 2181220,021812,etc. Thankyou.


See More: How use findstr to find exact numbers in txt file?

Report •

#1
February 15, 2014 at 12:33:29
✔ Best Answer
What about

findstr "\<21812\>"


Report •
Related Solutions


Ask Question