Hide Clipart | Topics | Search
Log Out | Register | Edit Profile
Last 30 mins | 1 | 2

Batch files(DOS Commands) help

Chalanachithram.com DB » New TF Industry Related » Archive through July 26, 2014 » Batch files(DOS Commands) help « Previous Next »

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostView Post/Check IPPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

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
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostView Post/Check IPPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

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

Add Your Message Here
Post:
Bold text Italics Underline Create a hyperlink Insert a clipart image HASH(0x9e653e4){Movie Clipart}
Show / hide regular icons selection options

Click on following links to open cliparts by Alphabetical Order

 A   B   C   D   E   F   G   H   I   J   K   L   M  

 N   O   P   Q   R   S   T   U   V   W   X   Y   Z  

Show / Hide Filmy icons selection options

Click on following links to open cliparts by Alphabetical Order

 A   B   C   D   E   F   G   H   I   J   K   L   M  

 N   O   P   Q   R   S   T   U   V   W   X   Y   Z  

Username: Posting Information:
This is a public posting area. Enter your username and password if you have an account. Otherwise, enter your full name as your username and leave the password blank. Your e-mail address is optional.
Password:
E-mail:
Options: Enable HTML code in message
Automatically activate URLs in message
Action: