[ale] Shell Script Question

Scott Steele roninazure at gmail.com
Fri Aug 12 10:57:05 EDT 2011


Thanks for your help so far on this, I received further clarification as
to what I need to do and I think it requires a little tweaking. For the
ones that are "state:reachable" I don't need any value returned, or
maybe a simple echo statement that says "reachable" or a numeric value
of "-1". I can change it if necessary.. For the ones that are in
"state:unreachable". I need a count of how many return like that. Say
5,6,7, or so on.  So the output I am interested in is:

-1 (good)

or

5 (bad)

This is the script so far that I have. For a reference point.

#!/bin/sh

export JAVA_HOME=/hosting/products/
WebSphereU01/java

#sets the environment in java

#the values -p -bp and -ch will need to be altered according to what
needs to be run.

/hosting/ogsa/ogsa-6.1.0.5/ObjectGrid/bin/xsadmin.sh -p 26572 -bp 26570
-ch nc3sz2ecmus02 -routetable | sed -e 's/.*state:reachable.*/>0/' e
's/.*state:unreachable.*/<0/' > `date "+%y%m%d%H%M%S"`.txt

This is the output it produces in its current form.

>0

>0

>0

And so forth.


On Thu, Aug 11, 2011 at 9:54 PM, Scott Steele <roninazure at gmail.com> wrote:

> I've been trying to test this script on my server at work, but
> unfortunately VPN has been flaking on me tonight:-(
>
> On Thu, Aug 11, 2011 at 8:35 PM, Jim Kinney <jim.kinney at gmail.com> wrote:
>
>> Oops. Change  .\* to. \+
>> On Aug 11, 2011 8:01 PM, "David Tomaschik" <david at systemoverlord.com>
>> wrote:
>> > On 08/11/2011 07:51 PM, Scott Steele wrote:
>> >> I haven't been able to try this code yet since I cannot connect to the
>> >> server, but would it return with just "1" value after if finishes with
>> >> a script? say 1 or -1? That would be what I would be looking for
>> >> SiteScope to understand.
>> >>
>> >> On Thu, Aug 11, 2011 at 6:22 PM, Jim Kinney <jim.kinney at gmail.com
>> >> <mailto:jim.kinney at gmail.com>> wrote:
>> >>
>> >> | sed -e 's/statereachable.\*/1/' -e 's/stateunreachable.\*/-1/'
>> >>
>> >> On Aug 11, 2011 6:16 PM, "Scott Steele" <roninazure at gmail.com
>>  >> <mailto:roninazure at gmail.com>> wrote:
>> >> > I am relatively a little rusty with the shell scripting and was
>> >> wondering if
>> >> > someone could help me with my dilemma. I use IBM WebSphere and
>> >> the command I
>> >> > use is:
>> >> >
>> >> > xsadmin.sh -p 11111 -bp 11111 -ch servername123 -routetable
>> >> >
>> >> > The output is an example of this:
>> >> >
>> >> > P: partition:83 - state:reachable - ipaddress:servername100 -
>> >> zone:ZoneB
>> >> >> R: partition:83 - state:reachable - ipaddress:servername101-
>> >> zone:ZoneA
>> >> > P: partition:84 - state:reachable - ipaddress:servername102 -
>> >> zone:ZoneB
>> >> >> R: partition:84 - state:reachable - ipaddress:servername103 -
>> >> zone:ZoneA
>> >> > P: partition:85 - state:reachable - ipaddress:servername104 -
>> >> zone:ZoneA
>> >> >> R: partition:85 - state:reachable - ipaddress:servername105 -
>> >> zone:ZoneB
>> >> >
>> >> > And so on.
>> >> >
>> >> > I need to condense the output of this file to send to SiteScope
>> >> as a file
>> >> > with only values of either <0 or >0. Meaning, if the
>> >> state:reachable it
>> >> > needs to appear as >0. if state:unreachable than the value needs
>> >> to appear
>> >> > as <0. I basically need to find a way to remove all erroneous
>> >> info and
>> >> > substitute the words state:reachable or state:unreachable with
>> >> either <0 or
>> >> >>0. I have tried many different methods, awk, sed and grep but
>> >> seem to come
>> >> > up short. Any help would be most appreciative and would be a
>> >> great learning
>> >> > tool.
>> >> >
>> >> > Thanks!
>> >>
>> >
>> > Are you looking for return value or output? For output, Jim's sed
>> > commands should work, but you might need a ".*" at the beginning of each
>> > pattern.
>> >
>> > Providing sample output with the sample input would probably help
>> > everyone understand.
>> >
>> > David
>>
>> _______________________________________________
>> Ale mailing list
>> Ale at ale.org
>> http://mail.ale.org/mailman/listinfo/ale
>> See JOBS, ANNOUNCE and SCHOOLS lists at
>> http://mail.ale.org/mailman/listinfo
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.ale.org/pipermail/ale/attachments/20110812/8a347e39/attachment.html 


More information about the Ale mailing list