I have a file (directorylist.txt) that contains the following lines:
141228-0010
141231-0004
150102-0110
150106-0015
150107-0003
150201-0007
The first 6 digits are a date (YYMMDD)
I need a way to list only the lines that match a variable corresponding with the month column MM. For example.. I have a variable %month% that equals 01. I need a file that shows:
150102-0110
150106-0015
150107-0003
I would like to make this happen using a windows batch script. Is there any way to use findstr or for loops? Other options like powershell?
findstr /r /b "..%month%" directorylist.txt
should work for you, if there are no other conditions you've not revealed.