Thanks for your help so far on this, I received further clarification as<br>
to what I need to do and I think it requires a little tweaking. For the<br>
ones that are "state:reachable" I don't need any value returned, or<br>
maybe a simple echo statement that says "reachable" or a numeric value<br>
of "-1". I can change it if necessary.. For the ones that are in<br>
"state:unreachable". I need a count of how many return like that. Say<br>
5,6,7, or so on. So the output I am interested in is:<br>
<br>
-1 (good)<br>
<br>
or<br>
<br>
5 (bad)<br>
<br>
This is the script so far that I have. For a reference point.<br>
<br>
#!/bin/sh<br>
<br>
export JAVA_HOME=/hosting/products/<div id=":88">WebSphereU01/java<br>
<br>
#sets the environment in java<br>
<br>
#the values -p -bp and -ch will need to be altered according to what<br>
needs to be run.<br>
<br>
/hosting/ogsa/ogsa-6.1.0.5/ObjectGrid/bin/xsadmin.sh -p 26572 -bp 26570<br>
-ch nc3sz2ecmus02 -routetable | sed -e 's/.*state:reachable.*/>0/' e<br>
's/.*state:unreachable.*/<0/' > `date "+%y%m%d%H%M%S"`.txt<br>
<br>
This is the output it produces in its current form.<br>
<br>
>0<br>
<br>
>0<br>
<br>
>0<br>
<br>
And so forth.</div><br><br><div class="gmail_quote">On Thu, Aug 11, 2011 at 9:54 PM, Scott Steele <span dir="ltr"><<a href="mailto:roninazure@gmail.com">roninazure@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I've been trying to test this script on my server at work, but unfortunately VPN has been flaking on me tonight:-( <br><br><div class="gmail_quote"><div><div></div><div class="h5">On Thu, Aug 11, 2011 at 8:35 PM, Jim Kinney <span dir="ltr"><<a href="mailto:jim.kinney@gmail.com" target="_blank">jim.kinney@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5"><p>Oops. Change .\* to. \+</p>
<div class="gmail_quote"><div>On Aug 11, 2011 8:01 PM, "David Tomaschik" <<a href="mailto:david@systemoverlord.com" target="_blank">david@systemoverlord.com</a>> wrote:<br type="attribution">> On 08/11/2011 07:51 PM, Scott Steele wrote:<br>
>> I haven't been able to try this code yet since I cannot connect to the<br>>> server, but would it return with just "1" value after if finishes with<br>>> a script? say 1 or -1? That would be what I would be looking for<br>
>> SiteScope to understand.<br>>><br>>> On Thu, Aug 11, 2011 at 6:22 PM, Jim Kinney <<a href="mailto:jim.kinney@gmail.com" target="_blank">jim.kinney@gmail.com</a><br></div><div>>> <mailto:<a href="mailto:jim.kinney@gmail.com" target="_blank">jim.kinney@gmail.com</a>>> wrote:<br>
>><br>>> | sed -e 's/statereachable.\*/1/' -e 's/stateunreachable.\*/-1/'<br>>><br>>> On Aug 11, 2011 6:16 PM, "Scott Steele" <<a href="mailto:roninazure@gmail.com" target="_blank">roninazure@gmail.com</a><br>
</div><div><div></div><div>
>> <mailto:<a href="mailto:roninazure@gmail.com" target="_blank">roninazure@gmail.com</a>>> wrote:<br>>> > I am relatively a little rusty with the shell scripting and was<br>>> wondering if<br>
>> > someone could help me with my dilemma. I use IBM WebSphere and<br>
>> the command I<br>>> > use is:<br>>> ><br>>> > xsadmin.sh -p 11111 -bp 11111 -ch servername123 -routetable<br>>> ><br>>> > The output is an example of this:<br>
>> ><br>>> > P: partition:83 - state:reachable - ipaddress:servername100 -<br>>> zone:ZoneB<br>>> >> R: partition:83 - state:reachable - ipaddress:servername101-<br>>> zone:ZoneA<br>
>> > P: partition:84 - state:reachable - ipaddress:servername102 -<br>>> zone:ZoneB<br>>> >> R: partition:84 - state:reachable - ipaddress:servername103 -<br>>> zone:ZoneA<br>
>> > P: partition:85 - state:reachable - ipaddress:servername104 -<br>>> zone:ZoneA<br>>> >> R: partition:85 - state:reachable - ipaddress:servername105 -<br>>> zone:ZoneB<br>
>> ><br>>> > And so on.<br>>> ><br>>> > I need to condense the output of this file to send to SiteScope<br>>> as a file<br>>> > with only values of either <0 or >0. Meaning, if the<br>
>> state:reachable it<br>>> > needs to appear as >0. if state:unreachable than the value needs<br>>> to appear<br>>> > as <0. I basically need to find a way to remove all erroneous<br>
>> info and<br>>> > substitute the words state:reachable or state:unreachable with<br>>> either <0 or<br>>> >>0. I have tried many different methods, awk, sed and grep but<br>
>> seem to come<br>>> > up short. Any help would be most appreciative and would be a<br>>> great learning<br>>> > tool.<br>>> ><br>>> > Thanks!<br>>><br>
> <br>> Are you looking for return value or output? For output, Jim's sed<br>> commands should work, but you might need a ".*" at the beginning of each<br>> pattern.<br>> <br>> Providing sample output with the sample input would probably help<br>
> everyone understand.<br>> <br>> David<br></div></div></div>
<br></div></div><div class="im">_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org" target="_blank">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
<br></div></blockquote></div><br>
</blockquote></div><br>