Sponsored Content
Top Forums Shell Programming and Scripting Filter output as an array element Post 302630351 by Chubler_XL on Wednesday 25th of April 2012 06:22:06 PM
Old 04-25-2012
How about this:

Code:
#!/bin/csh -f
set new = ( `awk '/Tx Server Status|Eg Server Status|ASM Server Status|DIPoller/ {print $4} /Int server/ {print $3}' srvoff` )
 
if ( "$new[1]" =~ Active && "$new[2]" =~ Active && "$new[3]" =~ Active && "$new[4]" =~ Active && "$new[5]" =~ Active) then
exit 110
else if ( "$new[1]" =~ NOT && "$new[2]" =~ NOT && "$new[3]" =~ NOT && "$new[4]" =~ NOT && "$new[5]" =~ NOT ) then
exit 100
else
exit 1
endif

This User Gave Thanks to Chubler_XL For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

accessing my first element of array

Hello everyonel, I have an array set like so num=4 read name arr=name I go through while loop to assign different values to different array element from 1 to 4. when I try to access the FIRST element of the array I get the last one first. Like if I say ${arr} it will show the last element... (4 Replies)
Discussion started by: afadaghi
4 Replies

2. Shell Programming and Scripting

Shift array element

I want to delete and 0th element of array in shell scrpit and also shift all others to one level up. (2 Replies)
Discussion started by: darshakraut
2 Replies

3. Shell Programming and Scripting

HELP unsetting array element in loop

I have a loop and I need to be able to unset the array element that I am currently accessing in it. I was thinking of making a counter that increments with the loop and doing unset $dirs but if I do that I am not sure if the other members of the array would get shifted down in index (meaning that... (2 Replies)
Discussion started by: msf5042
2 Replies

4. Shell Programming and Scripting

remove an element from array

I need to remove an element from the below array variable TABLENAME. #!/bin/ksh set -A TABLENAME "mirf roxar keke mirs" echo "the array is ${TABLENAME}" If i need to remove say keke and have the final TABLENAME as below, how this could be achieved. Pls throw some light. echo "Modified... (3 Replies)
Discussion started by: michaelrozar17
3 Replies

5. Shell Programming and Scripting

How to assign an array element to a variable

Hi every one.. I'm new to shell scripting... I would like to assign a single array element to a variable... Is it possible to do it.... Could any body help me.... (3 Replies)
Discussion started by: kaushik_87
3 Replies

6. Shell Programming and Scripting

previous element in the array perl

Hi, How to get previous/next element in the array perl Example @queue = (1, 2 ,3 , 4); I want to get value of 1 and 2, or, 2 and 3, or 3 and 4...etc and compare to value which one is greater to do that I need to get previous and next element of array ? (1 Reply)
Discussion started by: guidely
1 Replies

7. Shell Programming and Scripting

Multiplying array element

I am trying to take all the elements of an array and multiply them by 2, and then copy them to a new array. Here is what I have i=0 for true in DMGLIST do let DMGSIZES2="${DMGSIZES}"*2 let i++ done unset i echo ${DMGSIZES2} It does the calculation correctly for the first element,... (7 Replies)
Discussion started by: nextyoyoma
7 Replies

8. Shell Programming and Scripting

ksh insert element in array

Hi all, I need help with the following scenario in ksh. If the number of elements contained by arrayA is 11 I need to insert a zero as the element arrayA then print all arrayA elements separated by comma. Appreciate your help. (9 Replies)
Discussion started by: ejianu
9 Replies

9. Shell Programming and Scripting

How to insert an array element within regex?

Hello to all, I'm trying to separate the string "str" using a regex within match function. The substrings that I want to separate, begin with 22, 23, 24 or 25 and followed by 12 or 14 characters. And I want to replace 22 with MJS, 23 with UYT, 24 with WER and 25 with PIL. For this string... (4 Replies)
Discussion started by: Ophiuchus
4 Replies

10. UNIX for Advanced & Expert Users

Array Element

This question is for someone that's more familiar with Array Element. I need to know if the maximum array element that can be assigned is 1024 and if its so, Is there a workaround solution when the counter exceeded 1024? param_array="$param_nam" counter=$counter+1 #to avoid space... (3 Replies)
Discussion started by: cumeh1624
3 Replies
Data::Stream::Bulk::Filter(3pm) 			User Contributed Perl Documentation			   Data::Stream::Bulk::Filter(3pm)

NAME
Data::Stream::Bulk::Filter - Streamed filtering (block oriented) VERSION
version 0.11 SYNOPSIS
use Data::Stream::Bulk::Filter; Data::Stream::Bulk::Filter->new( filter => sub { ... }, stream => $stream, ); DESCRIPTION
This class implements filtering of streams. ATTRIBUTES
filter The code reference to apply to each block. The block is passed to the filter both in $_ and as the first argument. The return value should be an array reference. If no true value is returned the output stream does not end, but instead an empty block is substituted (the parent stream controls when the stream is depleted). stream The stream to be filtered METHODS
is_done loaded Delegated to "stream" next Calls "next" on "stream" and applies "filter" if a block was returned. AUTHOR
Yuval Kogman <nothingmuch@woobling.org> COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Yuval Kogman. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-02-14 Data::Stream::Bulk::Filter(3pm)
All times are GMT -4. The time now is 08:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy