   
Phoenix
Side Hero Username: Phoenix
Post Number: 3512 Registered: 10-2012 Posted From: 155.35.46.62
Rating: N/A Votes: 0 (Vote!) | | Posted on Friday, July 25, 2014 - 05:52 am: |
     |
google thalli evi echindi stackoverflow babai ni adigi..already chusunte ignore them... File has: URL: https://www.abc.com Repository Root: https://www.abc.com/svn Repository UUID: 12345678-8b61-fa43-97dc-123456789 Revision: 1234 Node Kind: directory Schedule: normal Last Changed Author: abc Last Changed Rev: 1234 Last Changed Date: 2010-04-01 18:19:54 -0700 (Thu, 01 Apr 2010) I am trying to read some info from a text file by using windows command line, and save it to a variable just like "set info =1234" Script: for /f "tokens=2" %%i in ('findstr Revision: input.txt') do set revision=%%i findstr is used to filter the file. It will print "input.txt:Revision: 1234" Then the "tokens=2" means that we are interested in the second token, "1234". By default for breaks on white space. One more: text file (vernum.txt) containing one line: At revision 2. How do I use dos cmd line to read in the line and save a variable with JUST the number? It will always be "At Revision ####." @ECHO off SET /P MYVAR=<vernum.txt ECHO MYVAR=%MYVAR% FOR /f "tokens=3* delims=.\ " %%K IN ( "%MYVAR%" ) DO ( SET /A RESULT=%%K ) ECHO The number is: %RESULT% pause |
   
Kadapanagfan
Legend Username: Kadapanagfan
Post Number: 52786 Registered: 12-2006 Posted From: 103.246.196.13
Rating: N/A Votes: 0 (Vote!) | | Posted on Friday, July 25, 2014 - 05:33 am: |
     |
I have file test.txt with below content [INFO] Scanning for projects... [INFO] ------------------------------------------------------------ ------------ [INFO] Building fc-maven-core [INFO] task-segment: [fc:encrypt-password] (aggregator-style) [INFO] ------------------------------------------------------------ ------------ [INFO] [fc:encrypt-password] [INFO] Encrypted Password is XXXXXXXXXXX [INFO] ------------------------------------------------------------ ------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------ ------------ [INFO] Total time: 13 seconds [INFO] Finished at: Fri Jul 25 04:49:51 EDT 2014 [INFO] Final Memory: 48M/202M [INFO] ------------------------------------------------------------ ------------ I need to loop throuh those lines in batch file and print XXXXXXXXXXX Any help is appreciated |