Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.