amir07
April 23, 2008, 2:28pm
1
I have perl program and I know that while sending an e-mail the following code returns "Remote (/opt/seasoft/db/nervecenter.nms00tst1):"
in an email, I need to take out the entire "opt/seasoft/db/nervecenter" and leave with "ms00tst1" only. How do I do it:
So the output would be "Remote (nms00tst1)"
$email_msg .= "Remote (".$server->[3]."):\n";
Thanks.,
era
April 23, 2008, 2:57pm
2
I'm not sure I understand your request, but here's a first attempt.
my $remote = $server->[3];
$remote =~ s%.*\.%%; # Remove up to first dot
$email_msg .= "Remote ($remote):\n";
If you want to remove the n after the dot too, I'm sure you can figure that part out.
amir07
April 23, 2008, 3:08pm
3
$$server->[3] will return (/opt/seasoft/db/nervecenter.nms00tst1)
(This path is hardcoded)
But the email return the entire path (/opt/seasoft/db/nervecenter.nms00tst1)
I need to return only "Remote (nms00tst1)."
Thanks.
era
April 24, 2008, 2:50am
4
And for some reason you didn't try the code I posted?
vnix$ perl -le '$server->[3] = "/opt/seasoft/db/nervecenter.nms00tst1";
> my $remote = $server->[3]; $remote =~ s%.*\.%%; $email_msg .= "Remote ($remote):\n";
> print $email_msg'
Remote (nms00tst1):
vnix$