07-10-2008
Just a couple of suggestions that may help you.
I would put the IP address into an array. The loop through and look for the agent_address:
i.e.
@ips = qw(10.216.74.137 10.216.74.144 10.216.74.148);
$agent_address = "10.216.74.144";
foreach(@ips) {
print "$_\n" if(/$agent_address/);
}
And for the second one, maybe using a search\replace regex to grab the end of the string:
i.e.
$probablecause = "enterprises.alcatel.nmu.genos.alarmHandoff.alarmHandoffObjects.alarmTable.alarmEntry.probableCause. 3 200904 = Replaceable Unit Missing";
$probablecause =~ s/.*probableCause.*\s=\s(.*)/$1/;
print "$probablecause\n";
Hope this helps.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
What am I doing wrong with this foreach loop?
foreach var ($argv)
@sum = $sum + $var (4 Replies)
Discussion started by: haze21
4 Replies
2. Shell Programming and Scripting
Hi Guys,
I have a loop which uses a wildcard
i.e. foreach f (*)
but when I execute the tcsh file in unix then it gives me an error
->>>>>>>foreach: words not parenthesized<<<<<<<<<<-
Any help. (1 Reply)
Discussion started by: abch624
1 Replies
3. Shell Programming and Scripting
In a foreach loop, is it possible for the loop to go through 2 arguments instead of one
i.e. instead of foreach i (do stuff for i), we have foreach i j(do stuff for i; do stuff for j)
I am working under BASH and TCSH shell environments
cheers (3 Replies)
Discussion started by: JamesGoh
3 Replies
4. Shell Programming and Scripting
Hi everyone
Does anyone know what is wrong with this script. i keep getting errors
foreach filename (`cat testing1`)
set string=$filename
set depth=`echo "$string"
echo $depth
end
the error is the following
testing: line 1: syntax error near unexpected token `('
testing: line 1:... (3 Replies)
Discussion started by: ROOZ
3 Replies
5. UNIX for Advanced & Expert Users
Hi All,
Is there any problem with the below 'foreach' loop?
foreach risk_factor ($(cat "$rf_list"))
where "rf_list=$SCRIPT/Utility/rflist.txt "
I'm wondering, it is throwing below error message:
syntax error at line 34: `(' unexpected
Any idea/suggestions ?
Thanks in advance /... (7 Replies)
Discussion started by: ganapati
7 Replies
6. Shell Programming and Scripting
So I am back again beating my head against the wall with a shell script and getting a headache! I want to change each year in a file (1980, 1981, 1982, 1983, etc.) to the same year followed by a tab.
The input is "blah blah (1980) blah blah".
I want to get "blah blah (1980 ) blah blah".... (2 Replies)
Discussion started by: Peggy White
2 Replies
7. UNIX for Dummies Questions & Answers
I am trying to make a script for my Counter-Strike: Source servers. What i am wanting it to do is for it to restart each server, the only way i can think of doing this in through for each.
Years what i have at the moment.
server_start() {
START=`ps x | grep SCREEN | grep $SRV | cut -d '?' -f... (5 Replies)
Discussion started by: grahamn95
5 Replies
8. Shell Programming and Scripting
Dear all,
I wrote a script to download files and move files in directories according to their name.
Now here is the problem:
Both p101 and p360 data download successfully, but when I move them according to the year and month, only p101 data can be placed at the right location, p360,... (1 Reply)
Discussion started by: handsonzhao
1 Replies
9. UNIX for Dummies Questions & Answers
Hi everyone I'm new to unix and encountered a small problem i couldnt find out a reason why it doesn't work..please help..
in my csh script when i tried to use the foreach loop like this:
foreach x ( ls )
echo $x
end
when i tried to run it, it printed out 'ls' to the std out instead of... (3 Replies)
Discussion started by: ymc1g11
3 Replies
10. Shell Programming and Scripting
I need to put together a script that will take the contents of two different files (database name and database owner) and put them in two variables within a line:
foreach x (`cat /local/hd3/dba/tools/build_db_scripts/dbs`)
foreach z (`cat /local/hd3/dba/tools/build_db_scripts/dbas`)... (6 Replies)
Discussion started by: deneuve01
6 Replies
LEARN ABOUT DEBIAN
corosync-notifyd
COROSYNC-NOTIFYD(8) System Manager's Manual COROSYNC-NOTIFYD(8)
NAME
corosync-notifyd - Listen for important corosync events and send dbus and/or snmp traps.
SYNOPSIS
corosync-notifyd [-f] [-l] [-o] [-s] [-m] [manager] [-d] [-h]
DESCRIPTION
corosync-notifyd uses corosync API to listen for important cluster events and can log them, generate dbus signals or genterate snmp traps.
OPTIONS
-f Start application in foreground.
-l Log all events.
-o Print events to stdout (turns on -l).
-s Send SNMP traps on all events.
-m Set the SNMP manager address.
-d Send DBUS signals on all events.
-h Print this help
EXAMPLES
$ corosync-notifyd -o
corosync-notifyd[18505]: troll[23374016] corosync-notify:18505:12 is now connected to corosync
corosync-notifyd[18505]: troll[23374016] corosync-notify:18505:13 is now disconnected from corosync
corosync-notifyd[18505]: troll[23374016] is now quorate
corosync-notifyd[18505]: r2[1550100672] ip:192.168.100.92 joined
corosync-notifyd[18505]: r2[1550100672] ip:192.168.100.92 left
$ corosync-notifyd -o
Note this output below is from "dbus-monitor --system"
signal sender=:1.216 -> dest=(null destination) serial=2 path=/com/redhat/cluster/corosync;
interface=com.redhat.cluster.corosync; member=ConnectionStateChange
string "troll"
uint32 23374016
string "corosync-notify:18900:12"
string "connected"
signal sender=:1.216 -> dest=(null destination) serial=3 path=/com/redhat/cluster/corosync;
interface=com.redhat.cluster.corosync; member=ConnectionStateChange
string "troll"
uint32 23374016
string "corosync-notify:18900:13"
string "disconnected"
signal sender=:1.216 -> dest=(null destination) serial=4 path=/com/redhat/cluster/corosync;
interface=com.redhat.cluster.corosync; member=QorumStateChange
string "troll"
uint32 23374016
string "quorate"
signal sender=:1.216 -> dest=(null destination) serial=5 path=/com/redhat/cluster/corosync;
interface=com.redhat.cluster.corosync; member=NodeStateChange
string "r2"
uint32 1550100672
string "192.168.100.92"
string "joined"
signal sender=:1.216 -> dest=(null destination) serial=6 path=/com/redhat/cluster/corosync;
interface=com.redhat.cluster.corosync; member=NodeStateChange
string "r2"
uint32 1550100672
string "192.168.100.92"
string "left"
SEE ALSO
corosync(8), corosync-objctl(8), dbus-monitor(1),
AUTHOR
Angus Salkeld
2011-01-14 COROSYNC-NOTIFYD(8)