Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Windows batch files to execute this task:

I would like to read a text file in which the variables are in quotes and are on seperate lines.

If the variable is Alphanumeric, then it goes in the Alphanumeric.txt

If the variable contains a Non-Alphanumeric character, then it goes in the Non-Alphanumeric.txt

The list is randon in length.

Thanks in advance for any responses.

share|improve this question
What are you trying to achieve, and what have you tried? – user3463 Jun 10 '12 at 3:03

Use the FINDSTR command. It supports grep-like pattern matching.

:: Find all lines matching the pattern
findstr /r ^\"[0-9A-Za-z]\"$ infile.txt > Alphanumeric.txt
:: Find all lines not matching the pattern
findstr /r /v ^\"[0-9A-Za-z]\"$ infile.txt > Non-Alphanumeric.txt
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .