So a lot of this is testing for conditions it seems. So here's how you test for the before A00 of Chicago and New York:
for /f "tokens=*" %%A in ('dir /b *.xls') do (
set Txtline=%%A
if /i "!Txtline:~0,7!"=="Chicago" (
more)
if /i "!Txtline:~0,8!"=="New York" (
more)
Then, if you are looking to find only certain keywords, try this:
echo !Txtline! | find "Train" >nul
if errorlevel 0 (echo Train was found)
So you can set up your commands in place of the echo. From there, you could set it so that the output name only has Train in it by either defining the output explicitly or using a set name=!Txtline:~0,13! Train or something similar to capture the first part of the name as well.
You seem like you know a little about what you are doing, which is why I'm choosing to provide more of some helpful tricks for you to use rather than a built script.