I've a file called "data.txt" with the below lines:
I need an output in the below format. Please help me.
Explanation of above o/p:
If the pattern between "<tell://me/" and ">" is same on any of the lines that contains "TT" then take only one line from them.
That line should be followed by the lines followed by the actual lines that have the same pattern between "<tell://me/" and ">".
And whenever a line is not preceded with TT line, that line should be taken as it is.
Looking forward to your help as soon as possible. Let me know if any queries.
Hi all,
Have the following code(1) producing the results(2 & 3).
Would like to know if there is a way to format the two reports created in a similar fashion.
IE - The first is formatted nicely as a result of the echo "$xmpbdate $xavgs" >> $xmpbrpt
However when I attempt to do the same on... (7 Replies)
Hi guys ,
I have a file which contains following string.(filename tempdisplay)
(location 0.0.0.0:5900)
i needed to write a script which will extract the string that comes after
0.0.0.0 i.e the string :5900.
I have used following method to extract the string :5900 .Is it a preferred way of... (4 Replies)
I have a following string.
"machine=IFLMUD5HP0581&group1=Stop"
I have created 2 variables namely machine and action.
machine should contain
IFLMUD5HP0581
action should contain
Stop
How do i write a script for the same. (7 Replies)
I have a file called abc.txt which has following contents.
10.180.8.231=31608
10.180.8.232=29011
10.180.8.233=31606
10.180.8.234=40501
10.180.8.235=32591
10.180.8.236=31605
10.180.8.237=30561
10.180.8.238=14231
How would i find a ip address having maximum number of ram available.
Here... (2 Replies)
How would i write a script which will add a following content to a file.
File Before running script.
acpi = 1
apic = 1
builder = 'hvm'
device_model = '/usr/lib/xen/bin/qemu-dm'
disk =
File After running the script.
acpi = 1
apic = 1
builder = 'hvm'
device_model =... (5 Replies)
I am executing the following command:
sort file1.txt | uniq -c | sort -n > file2.txt
The problem is that in file 2, I get leading spaces, Like so:
1 N/A|A8MW11
8 N/A|ufwo1
9 N/A|a8mw11
10 900003|smoketest297688
10 N/A|a9dg4
10 danny|danni
12... (5 Replies)
Hi,
Can anyone tell me how i can convert all tab spaces inside a script to 4 spaces through another script.
Also i need to find if all the quotes are matching and ended properly. Any idea whould be of great help.
Many thanks! (3 Replies)
I am using FORTRAN 90 on AIX 5.3 and need to output my data to a tab-delimited file. It must have actual tabs, and I cannot figure out a way to make it work. The resulting file will be imported into another application (quickbooks) as an .iif file....for some reason, it needs the tabs; spaces do... (2 Replies)
I have the output like below:
DEV#: 9 DEVICE NAME: hdisk9 TYPE: 1750500 ALGORITHM: Load Balance
SERIAL: 68173531021
==========================================================================
Path# Adapter/Path Name State Mode Select Errors
0 ... (4 Replies)
Hi All,
Need your help in resolving the below issue.
I've a file called "data.txt" with the below lines:
TT: <tell://me/sreenivas>
<tell://me/100>
TT: <tell://me/sudheer>
<tell://me/300>
TT: <tell://me/sreenivas>
<tell://me/200>
TT: <tell://me/sudheer>
<tell://me/400>
... (3 Replies)
Discussion started by: raosr020
3 Replies
LEARN ABOUT DEBIAN
mail::message::body::construct
Mail::Message::Body::Construct(3pm) User Contributed Perl Documentation Mail::Message::Body::Construct(3pm)NAME
Mail::Message::Body::Construct - adds functionality to Mail::Message::Body
DESCRIPTION
This package adds complex functionality to the Mail::Message::Body class. This functions less often used, so many programs will not
compile this package.
METHODS
Constructing a body
$obj->attach(MESSAGES, OPTIONS)
Make a multipart containing this body and the specified MESSAGES. The options are passed to the constructor of the multi-part body. If
you need more control, create the multi-part body yourself. At least take a look at Mail::Message::Body::Multipart.
The message-parts will be coerced into a Mail::Message::Part, so you may attach Mail::Internet or MIME::Entity objects if you want
--see Mail::Message::coerce(). A new body with attached messages is returned.
example:
my $pgpkey = Mail::Message::Body::File->new(file => 'a.pgp');
my $msg = Mail::Message->buildFromBody(
$message->decoded->attach($pgpkey));
# The last message of the $multi multiparted body becomes a coerced $entity.
my $entity = MIME::Entity->new;
my $multi = $msg->body->attach($entity);
# Now create a new message
my $msg = Mail::Message->new(head => ..., body => $multi);
$obj->concatenate(COMPONENTS)
Concatenate a list of elements into one new body.
Specify a list of text COMPONENTS. Each component can be a message (Mail::Message, the body of the message is used), a plain body
(Mail::Message::Body), "undef" (which will be skipped), a scalar (which is split into lines), or an array of scalars (each providing
one line).
example:
# all arguments are Mail::Message::Body's.
my $sum = $body->concatenate($preamble, $body, $epilogue, "--
" , $sig);
$obj->foreachLine(CODE)
Create a new body by performing an action on each of its lines. If none of the lines change, the current body will be returned,
otherwise a new body is created of the same type as the current.
The CODE refers to a subroutine which is called, where $_ contains body's original line. DO NOT CHANGE $_!!! The result of the
routine is taken as new line. When the routine returns "undef", the line will be skipped.
example:
my $content = $msg->decoded;
my $reply = $content->foreachLine( sub { '> '.$_ } );
my $rev = $content->foreachLine( sub {reverse} );
sub filled() { length $_ > 1 ? $_ : undef }
my $nonempty = $content->foreachLine( &filled );
my $wrong = $content->foreachLine( sub {s/a/A/} ); # WRONG!!!
my $right = $content->foreachLine(
sub {(my $x=$_) =~ s/a/A/; $x} );
$obj->stripSignature(OPTIONS)
Strip the signature from the body. The body must already be decoded otherwise the wrong lines may get stripped. Returned is the
stripped version body, and in list context also the signature, encapsulated in its own body object. The signature separator is the
first line of the returned signature body.
The signature is added by the sender to tell about him- or herself. It is superfluous in some situations, for instance if you want to
create a reply to the person's message you do not need to include that signature.
If the body had no signature, the original body object is returned, and "undef" for the signature body.
-Option --Default
max_lines 10
pattern qr/^--s?$/
result_type <same as current>
max_lines => INTEGER|undef
The maximum number of lines which can be the length of a signature. Specify "undef" to remove the limit.
pattern => REGEX|STRING|CODE
Which pattern defines the line which indicates the separator between the message and the signature. In case of a STRING, this is
matched to the beginning of the line, and REGEX is a full regular expression.
In case of CODE, each line (from last to front) is passed to the specified subroutine as first argument. The subroutine must return
TRUE when the separator is found.
result_type => CLASS
The type of body to be created for the stripped body (and maybe also to contain the stripped signature)
example:
my $start = $message->decoded;
my $start = $body->decoded;
my $stripped = $start->stripSignature;
my ($stripped, $sign) = $start->stripSignature
(max_lines => 5, pattern => '-*-*-');
SEE ALSO
This module is part of Mail-Box distribution version 2.105, built on May 07, 2012. Website: http://perl.overmeer.net/mailbox/
LICENSE
Copyrights 2001-2012 by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See
http://www.perl.com/perl/misc/Artistic.html
perl v5.14.2 2012-05-07 Mail::Message::Body::Construct(3pm)