[ale] Shell Script Question

Jim Kinney jim.kinney at gmail.com
Fri Aug 12 17:44:32 EDT 2011


grep -c "stateunreachable"

This return the count of unreachables

On Fri, Aug 12, 2011 at 11:21 AM, Scott Steele <roninazure at gmail.com> wrote:

> Yes, just one single output depending on "state:reachable" or
> "state:unreachable". On "state:unreachable" I am looking for a return value,
> say 5,6, etc. On the "state:reachable" just a value say 0 or even none at
> all.
>
>
> On Fri, Aug 12, 2011 at 11:03 AM, David Tomaschik <
> david at systemoverlord.com> wrote:
>
>> On Fri, Aug 12, 2011 at 10:57 AM, Scott Steele <roninazure at gmail.com>
>> wrote:
>> > 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.
>> >
>>
>> Do you need just a single value to be output?  And is it actually
>> looking for output, or a return value?
>>
>>
>>
>> --
>> David Tomaschik, RHCE, LPIC-1
>> System Administrator/Open Source Advocate
>> OpenPGP: 0x5DEA789B
>> http://systemoverlord.com
>> david at systemoverlord.com
>>
>> _______________________________________________
>> 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
>>
>
>
> _______________________________________________
> 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
>
>


-- 
-- 
James P. Kinney III

As long as the general population is passive, apathetic, diverted to
consumerism or hatred of the vulnerable, then the powerful can do as they
please, and those who survive will be left to contemplate the outcome.
- *2011 Noam Chomsky

http://heretothereideas.blogspot.com/
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.ale.org/pipermail/ale/attachments/20110812/6d5f94e4/attachment.html 


More information about the Ale mailing list