am a beginer of shell Unix, plesase tell me how to get parameter with $perl in loop
Code:
$ perl -lne '$/="DOCEND";print $_."DOCEND" if /$ACC/' file_input > output
i can't get parameter in loop with perl fucntion like this
pass paramerter to $ACC not accept in this script
$ACC = paramerter to find in text file_input / Ex. $ACC = ("KRAI","MARK")
EX.file_input
Code:
DOCSTART
DFSDF
NAME FIRSTNAME
ADDRESS
DSAFFD
DOCEND
DOCSTART
VEDFDSF
NAME KRAI
ADDRESS
SDFDSG
DOCEND
DOCSTART
LOUI
NAME ROBERT
ADDRESS
GHHW
DOCEND
DOCSTART
YYUI
NAME MARK
ADDRESS
LKJL;
DOCEND
DOCSTART
SAFD
NAME BEN
ADDRESS
8OIP
DOCEND
I need out put from loop with $perl like below
output text file
Code:
DOCSTART
VEDFDSF
NAME KRAI
ADDRESS
SDFDSG
DOCEND
DOCSTART
LOUI
NAME MARK
ADDRESS
GHHW
Last edited by Scott; 05-13-2010 at 08:06 AM..
Reason: Removed formatting, added code tags
I need to pass a parameter to a function in a script. My parameter is a string. When I display the parameter within my function, I only get the first word from string I pass in.
How can I make the function receive the whole string (and not terminate at the first space it encounters)?.
part of... (2 Replies)
Hello,
Could anyone help me with some KSH syntax? I'm trying to pass a list as a function parameter in a KSH?
For example I have code like this:
print_counter() {
N=$1
C=$2
for A in $C; do
echo "This is $N number $A"
done
}
NAME=BRICK
COUNT=" 1 2 3 4"
... (2 Replies)
HI all
I have a code like
##############################################
minyear()
{
curryear=$1
echo $curryear
}
##Main Program ##
minyear
exit
#######
when i execute "sh scriptname 2005" output should be like 2005 but the output is blank.
I guess i need to pass parameter to... (3 Replies)
hi,
i have a function say "mask". i'm passing parameters to the function like file_name \$1 |.
inside the function i'm naming the second parameter as position (i.e value of position will be "$1").
i'm passing the position's value like " $position=a"
But it is nor picking the value "$1".... (5 Replies)
Hi guys,
can someome help with this question, I have defined a function that takes a command as a parameter, but when the command is executed from the function it will throw errors because what I believe is a special character escaping issue. I tried using the backslash to escape the pipe | and >... (2 Replies)
hi all,
i have a parameter file of following format, i want a method which can get the value of specific parameter.
parameter file format:
<Parameter Name="FileLocationWindows">
<Description>
The directory location of the logger file.
... (1 Reply)
Hi All,
Just trying to implement the below shell script using AIX ksh shell.
myfunc {
eval "$*"
}
CMD='ls -la /etc/hosts | awk '{print $9"|"$5}''
myfunc $CMD
Keeping getting "|}: not found" errors, any pointers would greatly be appreciated.
Kind Regards
Ed
Please... (2 Replies)
Hi All,
I have created one function for KSH and was running well with one parameter input since I just had to use $1 to get the parameter.
Now I want to do loop for each parameter(actually filenames) . I have try to use do loop, but $i does not resolve to parameter instead it resolves to 1,... (5 Replies)
Discussion started by: mysocks
5 Replies
LEARN ABOUT DEBIAN
mail::verp
Verp(3pm) User Contributed Perl Documentation Verp(3pm)NAME
Mail::Verp - encodes and decodes Variable Envelope Return Paths (VERP) addresses.
SYNOPSIS
use Mail::Verp;
#Using class methods
#Change separator to something else
Mail::Verp->separator('+');
#Create a VERP envelope sender of an email to recipient@example.net.
my $verp_email = Mail::Verp->encode('sender@example.com', 'recipient@example.net');
#If a bounce comes back, decode $verp_email to figure out
#the original recipient of the bounced mail.
my ($sender, $recipient) = Mail::Verp->decode($verp_email);
#Using instance methods
my $verp = Mail::Verp->new(separator => '+');
#Create a VERP envelope sender of an email to recipient@example.net.
my $verp_email = $verp->encode('sender@example.com', 'recipient@example.net');
#Decode a bounce
my ($sender, $recipient) = $verp->decode($verp_email);
ABSTRACT
Mail::Verp encodes and decodes Variable Envelope Return Paths (VERP) email addresses.
DESCRIPTION
Mail::Verp encodes the address of an email recipient into the envelope sender address so that a bounce can be more easily handled even if
the original recipient is forwarding their mail to another address and the remote Mail Transport Agents send back unhelpful bounce
messages. The module can also be used to decode bounce recipient addresses.
FUNCTIONS
new()
Primarily useful to save typing. So instead of typing "Mail::Verp" you can say my $x = Mail::Verp->new; then use $x whereever
"Mail::Verp" is usually required.
Accepts an optional "separator" argument for changing the separator, which defaults to hyphen '-'. The value can also be changed using
the "separator" accessor.
my $x = Mail::Verp->new(separator => '+');
encode(LOCAL-ADDRESS, REMOTE-ADDRESS)
Encodes LOCAL-ADDRESS, REMOTE-ADDRESS into a verped address suitable for use as an envelope return address. It may also be useful to
use the same address in Errors-To and Reply-To headers to compensate for broken Mail Transport Agents.
Uses current separator value.
decode(VERPED-ADDRESS)
Decodes VERPED-ADDRESS into its constituent parts. Returns LOCAL-ADDRESS and REMOTE-ADDRESS in list context, REMOTE-ADDRESS in scalar
context. Returns VERPED-ADDRESS if the decoding fails.
Uses current separator value.
separator
Returns current value of the VERP "separator"
separator(SEPARATOR)
Sets new value for VERP "separator" and returns the previous value.
EXPORT
None.
SEE ALSO
DJ Bernstein details verps here: http://cr.yp.to/proto/verp.txt.
Sam Varshavchik proposes an encoding here: http://www.courier-mta.org/draft-varshavchik-verp-smtpext.txt.
AUTHOR
Gyepi Sam <gyepi@cpan.org>
COPYRIGHT AND LICENSE
Copyright 2007 by Gyepi Sam
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.10.0 2008-05-26 Verp(3pm)