Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
mor.bas
- Posts: 66
- Joined: 25 Apr 2012 04:28
#1
Post
by mor.bas » 06 Nov 2013 10:21
Hi,
I have a abtch that doing process with cluster.
I need to get date from table like:
I run the command :
cluster res "ABC" /stat
and get the output:
Code: Select all
Listing status for resource 'ABC':
Resource Group Node Status
-------------------- -------------------- --------------- ------
ABC PHX00483 try00481 Online
I need to print to file the node name (try00481)
And also like this I run the command:
cluster node
and get the output:
Code: Select all
Listing status for all available nodes:
Node Node ID Status
-------------- ------- --------------------
try00481 1 Up
try00481 2 Up
I need to print to the file the 2 nodes (try00481,try00481)
Thanks in advance...
EDIT aGerman: Code Tags
-
aGerman
- Expert
- Posts: 4678
- Joined: 22 Jan 2010 18:01
- Location: Germany
#2
Post
by aGerman » 06 Nov 2013 13:00
You should use [code][/code] BBCode-Tags for your output to let us know how it is formatted. What are the delimiters of the data fields? Spaces or Tabs? (Redirect the output into a file to figure it out.)
Regards
aGerman
-
mor.bas
- Posts: 66
- Joined: 25 Apr 2012 04:28
#3
Post
by mor.bas » 06 Nov 2013 13:23
Here I put the output of the command-line more clearrly (I dont' know the bbcode....)
Resource Group Node Status
---------- --------- -------------------- ---------------
ABC PHX00483 try00481 Online
Node Node ID Status
-------------- ------- --------------------
try00481 1 Up
try00481 2 Up
I need to print to a file the data under the node colume...
-
mor.bas
- Posts: 66
- Joined: 25 Apr 2012 04:28
#4
Post
by mor.bas » 06 Nov 2013 13:33
oh I saw ont the web the bbcode ...
<table>
<tbody>
<tr>
<th>Resource</th>
<th>group</th>
<th>Node</th>
<th>status</th>
</tr>
<tr>
<td>ABC</td>
<td>PHX00483</td>
<td>try00481</td>
<td>Online</td>
</tr>
And the second table....
<table>
<tbody>
<tr>
<th>Node</th>
<th>ID</th>
<th>status</th>
</tr>
<tr>
<td>try00481</td>
<td>1</td>
<td>up</td>
</tr>
<tr>
<td>try00480</td>
<td>2</td>
<td>up</td>
</tr>
-
aGerman
- Expert
- Posts: 4678
- Joined: 22 Jan 2010 18:01
- Location: Germany
#5
Post
by aGerman » 06 Nov 2013 14:40
I edited your initial post (click on the Edit button top right to see what I did).
What I would like to know is what are the delimiters between the data fields.
See my privious reply.
Regards
aGerman
-
mor.bas
- Posts: 66
- Joined: 25 Apr 2012 04:28
#6
Post
by mor.bas » 06 Nov 2013 15:04
Hi,
Like you edit the first one.
There is only one space between -----.
And the data below the ---- is aligned to the title.
Thanks....
-
aGerman
- Expert
- Posts: 4678
- Joined: 22 Jan 2010 18:01
- Location: Germany
#7
Post
by aGerman » 06 Nov 2013 15:25
Hmm, I hoped it would be tabs. Now these lines wouldn't work if there are spaces in the data fields. Try:
Code: Select all
>"out1.txt" (
for /f "skip=3 tokens=3" %%i in ('cluster res "ABC" /stat') do echo %%i
)
>"out2.txt" (
for /f "skip=3" %%i in ('cluster node') do echo %%i
)
Regards
aGerman
-
mor.bas
- Posts: 66
- Joined: 25 Apr 2012 04:28
#8
Post
by mor.bas » 07 Nov 2013 01:21
Hi,
Can you explain in deeply all the issue of skip and token here?
Thanks,
Eran