10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
value=malayalam
# i need to store the value in an array by splitting the character
#the output i need is
m
a
l
a
y
a
l
a
m
Please use CODE tags for output data as well as required by forum rules! (5 Replies)
Discussion started by: Meeran Rizvi
5 Replies
2. Shell Programming and Scripting
Hi All,
How to split the string KAR_Celltick_Ban_GSMGW3 and want to pickup the third filed. Sometime the string may be "KAR_Celltick_Ban" like this
Thanks in advance (1 Reply)
Discussion started by: sujit_kashyap
1 Replies
3. Shell Programming and Scripting
Hi,
We have a SunOS 5.10 Generic_142900-13 sun4v sparc SUNW,T5240.
I'm trying to find a way to split a string into 2 variables.
Ex:
parm1="192.168.1.101/parent/child"
What I need to do is split the string above into:
host="192.168.1.101"
location="parent/child"
I saw the... (3 Replies)
Discussion started by: adshocker
3 Replies
4. Shell Programming and Scripting
Hi
I am facing a problem in spitting a string.
Here is the string
--------------------
subject1=10;subject2=30;subject3=40;subjectcode=10001;...
Now, I want only marks not the subject code. (there can be 'n' subjects)
ie.
10
30
40
My doubt
----------
How do I... (5 Replies)
Discussion started by: jionnet
5 Replies
5. Shell Programming and Scripting
Hi,
can we split a number like this.. if i have something like 85743975945738, can it be converted as 8574-3975-945738 in ksh shell using single command...
Thanks! (5 Replies)
Discussion started by: nram_krishna@ya
5 Replies
6. Shell Programming and Scripting
I need to split the string msu1_2
It should be generic for any string of the form msu<digits>_<digits>
so that i get $X =1 and $Y = 2
Please help
Thanks (5 Replies)
Discussion started by: asth
5 Replies
7. Shell Programming and Scripting
Hi,
I am new to scripting and need help splitting a string using space as the delimiter.
How can I do that?
I want the result to be stored in an Array.
I tried using
set -A arr $(echo $FILE)
echo $arr
The result of the above was ''.
Thanks. (2 Replies)
Discussion started by: newbie187
2 Replies
8. Shell Programming and Scripting
could anyone help in running split cmd
split("String1,outputArray,"delimiter);
with sample script?.
for eg i have abc-def-ghi-sdf-
my ultimate aim of asking this is i have a string containing hypens,
i want to get the string before last n(2) Hypens (4 Replies)
Discussion started by: senthilk615
4 Replies
9. Shell Programming and Scripting
Hi
I have a script that loops though lines of a file and reads each line in to a variable ($LINE).
I want to look at the line and split it into it's constituent parts.
e.g. a line might be "This is a string"
I want to then have variables set to each element thus:
A=This
B=is
C=a... (3 Replies)
Discussion started by: gazingdown
3 Replies
10. Shell Programming and Scripting
to find log files modification, i want to select all the lines of a file behind a string (found by grep ?).
:rolleyes: (6 Replies)
Discussion started by: jpl35
6 Replies
MboxParser::Mail::Body(3pm) User Contributed Perl Documentation MboxParser::Mail::Body(3pm)
NAME
Mail::MboxParser::Mail::Body - rudimentary mail-body object
SYNOPSIS
use Mail::MboxParser;
[...]
# $msg is a Mail::MboxParser::Mail
my $body = $msg->body(0);
# or preferably
my $body = $msg->body($msg->find_body);
for my $line ($body->signature) { print $line, "
" }
for my $url ($body->extract_urls(unique => 1)) {
print $url->{url}, "
";
print $url->{context}, "
";
}
DESCRIPTION
This class represents the body of an email-message. Since emails can have multiple MIME-parts and each of these parts has a body it is not
always easy to say which part actually holds the text of the message (if there is any at all). Mail::MboxParser::Mail::find_body will help
and suggest a part.
METHODS
as_string ([strip_sig => 1])
Returns the textual representation of the body as one string. Decoding takes place when the mailbox has been opened using the decode =>
'BODY' | 'ALL' option.
If 'strip_sig' is set to a true value, the signature is stripped from the string.
as_lines ([strip_sig => 1])
Sames as as_string() just that you get an array of lines with newlines attached to each line.
NOTE: When the body is actually some encoded binary data (most commonly such a body is base64-encoded), you can still use this method.
Then you wont really get proper lines. Instead you get chunks of binary data that you should concatenate as in
my $binary = join "", $body->as_lines;
If 'strip_sig' is set to a true value, the signature is stripped from the string.
signature
Returns the signature of a message as an array of lines. Trailing newlines are already removed.
$body->error returns a string if no signature has been found.
extract_urls
extract_urls (unique => 1)
Returns an array of hash-refs. Each hash-ref has two fields: 'url' and 'context' where context is the line in which the 'url' appeared.
When calling it like $mail->extract_urls(unique => 1), duplicate URLs will be filtered out regardless of the 'context'. That's useful
if you just want a list of all URLs that can be found in your mails.
$body->error() will return a string if no URLs could be found within the body.
quotes
Returns a hash-ref of array-refs where the hash-keys are the several levels of quotation. Each array-element contains the paragraphs of
this quotation-level as one string. Example:
my $quotes = $msg->body($msg->find_body)->quotes;
print $quotes->{1}->[0], "
";
print $quotes->{0}->[0], "
";
This should print the first paragraph of the mail-body that has been quoted once and below that the paragraph that supposedly is the
reply to this paragraph. Perhaps thus:
> I had been trying to work with the CGI module
> but I didn't yet fully understand it.
Ah, it is tricky. Have you read the CGI-FAQ that
comes with the module?
Mark that empty lines will not be ignored and are part of the lines contained in the array of $quotes->{0}.
So below is a little code-snippet that should, in most cases, restore the first 5 paragraphs (containing quote-level 0 and 1) of an
email:
for (0 .. 4) {
print $quotes->{0}->[$_];
print $quotes->{1}->[$_];
}
Since quotes() considers an empty line between two quotes paragraphs as a paragraph in $quotes->{0}, the paragraphs with one quote and
those with zero are balanced. That means:
scalar @{$quotes->{0}} - DIFF == scalar @{$quotes->{1}} where DIFF is element of {-1, 0, 1}.
Unfortunately, quotes() can up to now only deal with '>' as quotation-marks.
VERSION
This is version 0.55.
AUTHOR AND COPYRIGHT
Tassilo von Parseval <tassilo.von.parseval@rwth-aachen.de>
Copyright (c) 2001-2005 Tassilo von Parseval. This program is free software; you can redistribute it and/or modify it under the same
terms as Perl itself.
SEE ALSO
perl v5.12.3 2005-12-08 MboxParser::Mail::Body(3pm)