Match Specific Characters in File Content and Print as Incremented Numeric List

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Posts: 3
Joined: 27 Apr 2020 14:56

Match Specific Characters in File Content and Print as Incremented Numeric List

#1 Post by mojobadshah » 27 Apr 2020 15:48

I've been working with FINDSTR and FOR commands. I want to procure a BATCH file that will match specific characters or character strings in the contents of a text file and output these matches with incrementing numeric values appended to them. Using the FOR command in conjunction with the (1,1,5) an increment orientation appears to only work as an application to file "directories" and not in "file content." FIND as a command appeared to only be applicable in the same way (as much as plenty of resources seem to show FIND /c is a command and operator that you can use to process file content its utility has obvious restrictions). FOR works by being inclusive of an additional FINDSTR command and "DO" statement, but negates from being able to implement "tokens and delimiters" where only "DO SET" statements will function with FOR commands, but inversely the FINDSTR element has to be taken out as a subroutine systematically. Appending variable paths with a "+1" parameter do tend to pump out results, but hardly contribute to conditions that must be inclusive of a list reiteration of duplicate terms (a simple split at delimiter or match string will turn out reflectively similar and indistinguishable results). So what BATCH script match string and append quantified numeric increment will print or echo a list according to the formula indicated and posted above?

eg. find char matches eg. N and Stdout >


Post Reply