Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to grep a string and add to subject line of a mail? Post 302839859 by vrkcamry on Saturday 3rd of August 2013 09:30:25 AM
Old 08-03-2013
Thank you for giving me your time on this. I have worked on Regex commands before and have some knowledge. I am now trying to educate myself on your code works so I can further refine it.

thanks again!
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

date need to be add in the subject of the mail.

Hi Am fetching a weekly report pf data..once i fetched the data i need a sent report by mail. In the subject of that mail i want to sent a message like.. SUBJECT :The report had been fetched from (01/12/08 to 07/12/08). I need to send a report like this every week with that particular... (2 Replies)
Discussion started by: bobprabhu
2 Replies

2. Shell Programming and Scripting

Grep a string and print a string from the line below it

I know how to grep, copy and paste a string from a line. Now, what i want to do is to find a string and print a string from the line below it. To demonstrate: Name 1: ABC Age: 3 Sex: Male Name 2: DEF Age: 4 Sex: Male Output: 3 Male I know how to get "3". My biggest problem is to... (4 Replies)
Discussion started by: kingpeejay
4 Replies

3. Shell Programming and Scripting

grep on string and printing line after until another string has been found

Hello Everyone, I just started scripting this week. I have no background in programming or scripting. I'm working on a script to grep for a variable in a log file Heres what the log file looks like. The x's are all random clutter xxxxxxxxxxxxxxxxxxxxx START: xxxxxxxxxxxx... (7 Replies)
Discussion started by: rxc23816
7 Replies

4. Shell Programming and Scripting

Grep a string and write a value to next line of found string

Hi, I have two variables x and y. i need to find a particular string in a file, a workflow name and then insert the values of x and y into the next lines of the workflow name. basically it is like as below wf_xxxxxx $$a= $$b= $$c= figo $$d=bentley i need to grep the 'wf_xxxx' and then... (6 Replies)
Discussion started by: angel12345
6 Replies

5. Shell Programming and Scripting

Grep a string from input file and delete next three lines including the line contains string in xml

Hi, 1_strings file contains $ cat 1_strings /home/$USER/Src /home/Valid /home/Review$ cat myxml <projected value="some string" path="/home/$USER/Src"> <input 1/> <estimate value/> <somestring/> </projected> <few more lines > <projected value="some string" path="/home/$USER/check">... (4 Replies)
Discussion started by: greet_sed
4 Replies

6. Shell Programming and Scripting

Subject line missing while sending mail

Hi, I have below script PROJECT_NAME=UDL/UDL_Weekly sub= echo ${PROJECT_NAME}|cut -d "/" -f2 cat pr.sh|mail -s "`hostname`: $sub failed" sonu.pal@xyz.com While running the script I am receiving the subject line in mail as " podetlsapp01: failed' instead of " podetlsapp01: ... (1 Reply)
Discussion started by: sonu_pal
1 Replies

7. UNIX for Advanced & Expert Users

AIX - Sendmail - add hostname to subject of outgoing mail

Hello, I'm configuring sendmail on an AIX 7.1 server (bos.net.tcp.client 7.1.1.15). I've gotten sendmail to send mail through our Novell GroupWise server, so that mail from a user on the server appears to come from their GroupWise account, and replies to the email would go to their GroupWise... (0 Replies)
Discussion started by: eyebeam
0 Replies

8. Shell Programming and Scripting

Grep the last line and put on mail subject

I have mail: cat /home/oracle/scripts/dbsizedaily.txt | mail -s "$TODAY: PROD DB Size" $RECIPIENTS I like to get and put USED_GB and %USED of the very last row from /home/oracle/scripts/dbsizedaily.txt. /home/oracle/scripts/dbsizedaily.txt has : DATE TIME TOTAL_GB USED_GB ... (6 Replies)
Discussion started by: Daniel Gate
6 Replies

9. Shell Programming and Scripting

Search a string in a text file and add another string at the end of line

Dear All I am having a text file which is having more than 200 lines. EX: 001010122 12000 BIB 12000 11200 1200003 001010122 2000 AND 12000 11200 1200003 001010122 12000 KVB 12000 11200 1200003 In the above file i want to search for string KVB... (5 Replies)
Discussion started by: suryanarayana
5 Replies

10. Red Hat

How to add a new string at the end of line by searching a string on the same line?

Hi, I have a file which is an extract of jil codes of all autosys jobs in our server. Sample jil code: ************************** permission:gx,wx date_conditions:yes days_of_week:all start_times:"05:00" condition: notrunning(appDev#box#ProductLoad)... (1 Reply)
Discussion started by: raghavendra
1 Replies
CGI::Application::Plugin::ActionDispatch(3pm)		User Contributed Perl Documentation	     CGI::Application::Plugin::ActionDispatch(3pm)

NAME
CGI::Application::Plugin::ActionDispatch - Perl extension SYNOPSIS
# In "WebApp.pm"... package WebApp; use base 'CGI::Application'; use CGI::Application::Plugin::ActionDispatch; sub do_stuff : Path('do/stuff') { ... } sub do_more_stuff : Regex('^/do/more/stuff/?$') { ... } sub do_something_else : Regex('do/something/else/(w+)/(d+)$') { ... } DESCRIPTION
CGI::Application::Plugin::ActionDispatch adds attribute based support for parsing the PATH_INFO of the incoming request. For those who are familiar with Catalyst. The interface works very similar. This plugin is plug and play and shouldn't interrupt the default behavior of CGI::Application. CAVEATS
Be aware though, this plugin will not likely work with other modules that use attributes. This module should work with mod_perl. It however has not be thoroughly tested as such. If you have used it with mod_perl please e-mail me with your experience. METHODS
action_args() If using capturing parentheses in a Regex action. The captured values are accessible using this method. sub addElement : Regex('add/(d+)/(d+)') { my $self = shift; my($column, $row) = $self->action_args(); ... } The Path action will store everything after the matched path into the action args. # http://example.com/state/pa/philadelphia sub find_state_and_city : Path('state/') { my $self = shift; my($state, $city) = $self->action_args(); # $state == pa, $city == philadelphia ... } ACTIONS
Regex Regex action is used for regular expression matching against PATH_INFO. If capturing parentheses are used; the matched parameters are accesssible using the action_args() method. Regex('^blah/foo'); The Regex action either matches or it doesn't. There are no secrets to it. It is important to note Regex action takes priority. It is assumed if a Path and Regex action both match. The Regex action will take priority, which may not always be the outcome of least suprise, for instance: # http://example.com/music/the_clash sub clash : Path('/music/the_clash') {} # This is an exact match, BUT. sub the_class : Regex('/music/the_clash') {} # This takes priority. Beware. Path The Path action is basically a shortcut for a commonly used Regex action. # http://example.com/products/movies/2 sub show_product : Path('products/') { my $self = shift; my($category, $id) = $self->action_args(); .... } Is basically the same thing as. sub show_product : Regex('^/products/(w+)/(d+)') { my $self = shift; my($category, $id) = $self->action_args(); ... } For those that care, the Path('products/') will be converted to the regular expression "^/products/?(/.*)$"; then split('/') is run on the captured value and stored in action_args(). Runmode This action will take the method name and run a match on that. # http://example.com/foobar sub foobar : Runmode {} Default The default run mode if no match is found. Essentially the equivalent of the start_mode() method. sub default_mode : Default {} EXAMPLE
In CGI::Application module: package WebApp; use base 'CGI::Application'; use CGI::Application::Plugin::ActionDispatch; use strict; sub setup { my $self = shift; self->mode_param('test_rm'); $self->run_modes( basic_runmode => 'basic_runmode' ); } # Regular runmodes should work. sub basic_runmode { my $self = shift } The product() runmode will match anything starting with "/products" in the PATH_INFO. # http://example.com/myapp.cgi/products/this/is/optional/and/stored/in/action_args/ sub product : Path('products/') { my $self = shift; my($category, $product) = $self->action_args(); } The music() runmode will match anything starting with "/products/music" in the PATH_INFO. The product() runmode also matches "/products/music". However since this runmode matches closer it takes priority over product(). # http://example.com/myapp.cgi/products/music/product/ sub music : Path('products/music/') { my $self = shift; my $product = $self->action_args(); ... } This beatles() runmode will match ONLY "/product/music/beatles" or "/product/music/beatles/". Regex takes priority over Path so the previous runmodes which match this PATH_INFO are not run. # http://example.com/myapp.cgi/products/music/beatles/ sub beatles : Regex('^/products/music/beatles/?') { my $self = shift; ... } SEE ALSO
CGI::Application, CGI::Application::Dispatch http://github.com/jaywhy/cgi-application-plugin-actiondispatch AUTHOR
Jason Yates, <jaywhy@gmail.com> COPYRIGHT AND LICENSE
Copyright (C) 2006-2008 by Jason Yates This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available. perl v5.12.4 2011-10-26 CGI::Application::Plugin::ActionDispatch(3pm)
All times are GMT -4. The time now is 12:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy