|
Answer» how to do stringtokenizer in batch file (DOS Command) for Example set Str1=Log,error,java i want a method that will split this strings and want to iterate through each sting using for loop .the STANDARD WAY natively, is to use for loop and set the token , DELIM params. see for /? for more info. Here is another way in biterscripting.
Code: [Select]var str str1 ; set $Str1="Log,error,java" set $wsep = "," # Set token separator wex -p "1" $Str1 # Will get the first token "Log" wex -p "2" $Str1 # Will get the second token "error" wex -p "l" $Str1 # Will get the last (l) token - java wen $Str1 # Will get the token count - 3
cat "x.txt" > $Str1 wex -p "2" $Str1 # Will get the second word from file x.txt. Help page on wex command at http://www.biterscripting.com/helppages/wex.html
|