Sponsored Content
Full Discussion: perl pattern search
Top Forums Shell Programming and Scripting perl pattern search Post 302395974 by SkySmart on Wednesday 17th of February 2010 11:21:23 AM
Old 02-17-2010
perl pattern search

can someone help me out with the bolded?

else if (regmatch($Subject, "^Application") && (regmatch($From, "^etgh") && (regmatch($Body, ".*not authorized to use this server.*"))))



what this section of the code is suppose to do is to scan through the contents of $Body, if do a set of commands if the string "not authorized to use this server" is found. but i'm not sure if i set it up properly with the *
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl onliner to search the last line with an occurence of a pattern

Hi I need a perl onliner which seaches a line starting with a pattern(last occurence) and display it. similar to grep 'pattern' filename | tail -1 in UNIX Ex: I want to display the line starting with "cool" and which is a last occurence adadfadafadf adfadadf cool dfadfadfadfara... (4 Replies)
Discussion started by: ammu
4 Replies

2. Shell Programming and Scripting

Perl Search pattern error

Hi, I am trying to grep for two patterns from a set of 820 apache webserver logs, When I Try to search the pattern with a date stamp and use a wildcard character * for ex: /28/Aug/2008:21*/ to get all the log entries for that particular hour that is 21 st hour I get errors. Please kindly... (1 Reply)
Discussion started by: openspark
1 Replies

3. Shell Programming and Scripting

search a pattern and if pattern found insert new pattern at the begining

I am trying to do some thing like this .. In a file , if pattern found insert new pattern at the begining of the line containing the pattern. example: in a file I have this. gtrow0unit1/gctunit_crrownorth_stage5_outnet_feedthru_pin if i find feedthru_pin want to insert !! at the... (7 Replies)
Discussion started by: pitagi
7 Replies

4. Shell Programming and Scripting

perl:: search for tow pattern and replace the third pattern

Hi i want to search two pattern on same line and replace onther pattern.. INPut file aaaa bbbbb nnnnnn ttttt cccc bbbbb nnnnnn ppppp dddd ccccc nnnnnn ttttt ffff bbbbb oooooo ttttt now i want replace this matrix like.. i want search for "bbbbb","nnnnnn" and search and replace for... (4 Replies)
Discussion started by: nitindreamz
4 Replies

5. Shell Programming and Scripting

search more than one pattern with perl on same line

Hi friends, I want to search for some hex error codes in some files. After the hex error code is found, the occurences would be counted. Afterwards the found hex errorcode would be cat into a separate file. Here is my code: #!/usr/bin/perl use File::Basename; my $find = $ARGV; my... (2 Replies)
Discussion started by: sdohn
2 Replies

6. Shell Programming and Scripting

Multiple pattern search in perl

user 10 values content is: musage.py yes value user 11 values content is: gusage.py yes value how to print "user" string line by searching "content is:" string and "usage.py" string in perl (8 Replies)
Discussion started by: Anjan1
8 Replies

7. Shell Programming and Scripting

perl script to search n place a pattern

hi, i have one file as t1.txt as below hi hello welcome i want perl script to search for the pattern "abcd" in the file. if the pattern doesn't exist, i want to insert that pattern at the end of the same file t1.txt my o/p should be hi hllo welcome abcd thank you (3 Replies)
Discussion started by: roopa
3 Replies

8. Shell Programming and Scripting

Help need with PERL multiple search pattern matching!

My example file is as given below: conn=1 uid=oracle conn=2 uid=db2 conn=3 uid=oracle conn=4 uid=hash conn=5 uid=skher conn=6 uid=oracle conn=7 uid=mpalkar conn=8 uid=anarke conn=9 uid=oracle conn=1 op=-1 msgId=-1 - fd=104 slot=104 LDAPS connection from 10.10.5.6 to 10.18.6.5 conn=2... (3 Replies)
Discussion started by: sags007_99
3 Replies

9. UNIX for Beginners Questions & Answers

Using forward slash in search pattern in perl script

I have existing pattern in the perl script as: my $pattern = "^Line.*?:|^Errors*: |^SEVERE:.*?:|^Null pointer exception occurred"; and I wanted to include below keywords in my search pattern "I/O exception" and "FileNotFoundException"the problem is when I include my pattern like my... (5 Replies)
Discussion started by: ambarginni
5 Replies

10. UNIX for Beginners Questions & Answers

Grep/awk using a begin search pattern and end search pattern

I have this fileA TEST FILE ABC this file contains ABC; TEST FILE DGHT this file contains DGHT; TEST FILE 123 this file contains ABC, this file contains DEF, this file contains XYZ, this file contains KLM ; I want to have a fileZ that has only (begin search pattern for will be... (2 Replies)
Discussion started by: vbabz
2 Replies
powerman.dev(5) 						     powerman							   powerman.dev(5)

NAME
powerman.dev - PowerMan device specification files DESCRIPTION
PowerMan device specifications are rather wierd. For this reason, we suggest that you leave the writing of these scripts to the PowerMan authors. However, if you insist, here is how they work. Note: the authors do not guarantee that the PowerMan specification language will not change, however we are open to taking on maintenance of scripts submitted by PowerMan users. We can't guarantee that we'll be able to test new releases against all devices but we'll do our best not to break anything. NOTE: the best way to help us in this endeavor is to provide a ``simulator'' for your power controller and associated tests in the test subdirectory of the powerman source code. See the examples in that directory. By convention, device scripts are one device per file and are included as needed from a powerman.conf file, like this: include "/etc/powerman/icebox3.dev" A device script is surrounded by an outer block: specification "my_device_name" { # configuration settings # script blocks } The possible configuration settings are: timeout <float> (optional) device script timeout in seconds - applies to each script, the whole thing, not just a particular "expect". plug name { <string list> } (optional) if plug names are static, they should be defined. Any reference to a plug name in the powerman.conf must match one of the defined plug names. pingperiod <float> (optional) if a ping script is defined, and pingperiod is nonzero, the ping script will be executed periodically, every <float> sec- onds. Script blocks have the form: script <script_name> { # statements } Script blocks should all be grouped together with no config lines in between. Scripts are for performing particular operations such as power on, get power status, etc. The various script names are listed below. Those marked with [%s] are called with a plug name "argu- ment", which can be included in a send statements by including a %s (printf style). Warning: all the send strings are processed with printf and you can cause powermand to segfault if you include any printf tokens other than the appropriate zero or one %s. login Executed immediately on (re-)connect. If you need to login to the box, do it here. This is also a good place to descend through a first layer of menus. Caveat: % occurring in passwords must be escaped as %%. Caveat: occurs outside of client session so cannot be debugged with -T. A trick when debugging is to move this code into the status script temporarily so you can see what is going on. logout Executed prior to disconnect. Get device in a state so login script will work (though hopefully disconnecting will do that too). status_all, status[%s] Obtain plug state for all plugs or only the specified plug. When all plugs of a device are involved in a plug status query, the status_all script, if defined, will be called in preference to the status script; otherwise the status script is called for each plug. on_all, on_range[%s], on[%s] Power on all plugs, a range of plugs, or the specified plug. off_all, off_range[%s], off[%s] Power off all plugs, a range of plugs, or the specified plug. cycle_all, cycle_range[%s], cycle[%s] Power cycle all plugs, a range of plugs, or the specified plug. The intent of this command was to map to the RPC's cycle command; however, device script are increasingly implementing this in terms of a power off/delay/power so the off time can be controlled by the script. status_soft_all, status_soft[%s] Obtain soft power state for all plugs or only the specified plug. Soft Power refers to the "standby state" of the node. On means the node is powered up. Off means either the node is powered off at the plug or is powered on at the plug and in standby mode. This is really only useful on devices that include both a plug relay and a probe into the node attached to a non-standby power source. status_temp_all, status_temp[%s] Obtain temperature reading for all plugs or only the specified plug. Temperature is obtained by sampling a thermocouple in the node. Results are reported as a text string - not interpreted by Powerman beyond any regex chopping done by the script. status_beacon_all, status_beacon[%s] Obtain beacon state for all plugs or only the specified plug. Some RPC's include a way to flash a light on a node. beacon_on[%s] Flash beacon on the specified plug. beacon_off[%s] Clear beacon on the specified plug. reset_all, reset_range[%s], reset[%s] Reset all plugs, a range of plugs, or only the specified plug. Reset refers to signaling a motherboard reset butten header, not a plug cycle. Within a script, the following statements can be used: send <string> Send <string> to the device. delay <float> Pause script for <float> seconds. expect <string> <string> is compiled as a regular expression with regcomp(3). The regular expression is matched against device input. The script blocks until the regex is matched or the device timeout occurs (in which case the script is aborted). Upon matching, any parenthe- sized expressiones are assigned to variables: $1 for the first match, $2 for the second match, and so on. Warning: some implementa- tions of regex(3) silently fail if the regular expression exceeds available static storage. setplugstate [<string>|<regmatch>] <regmatch> [off=<string>] [on=<string>] Set the plug state. The first argument, if present, is the literal plug name or a <regmatch> from the previous expect which con- tains the plug name. If omitted, the plug name is presumed to be the script argument. The off and on strings are compiled regexes, which if matched by the second argument, result in the plug state being set to off or on. Yes we are applying regexes to reg- matches! If no off or on strings are provided, state will be unknown. ifoff, ifon Script statements enclosed in an ifon/ifoff block are conditional executed based on the state of the plug passed in as an argument. Ifon/ifoff blocks can only be used in single plug scripts that take an argument. foreachplug Script statements enclosed in a foreachplug block are executed iteratively with a %s argument defined for each target plug. Fore- achplug blocks can only be used in all plug scripts that take no argument. Script terminals are defined as follows: <float> decimal number - exponent forms not supported <string> Text surrounded by double quotes. May contain C style backslash-escaped characters, including three digit octal values, and most common backslash-escaped single character values. <string list> Multiple <string> values separated by white space. <script_name> Name of script (see above). <regmatch> Results of a parenthesized regular expression match are assigned to $1, $2, ... $N. FILES
/etc/powerman/*.dev ORIGIN
PowerMan was originally developed by Andrew Uselton on LLNL's Linux clusters. This software is open source and distributed under the terms of the GNU GPL. SEE ALSO
powerman(1), powermand(8), httppower(8), plmpower(8), vpcd(8), powerman.conf(5), powerman.dev(5), powerman-devices(7). http://sourceforge.net/projects/powerman powerman-2.3.5 2009-02-09 powerman.dev(5)
All times are GMT -4. The time now is 03:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy