![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Text formatting in Perl. | fenox | Shell Programming and Scripting | 2 | 02-15-2008 01:06 PM |
| Perl Sort on Text File | eltinator | Shell Programming and Scripting | 6 | 08-07-2007 11:20 AM |
| how to insert text before first line in perl | umen | Shell Programming and Scripting | 3 | 08-17-2006 12:25 AM |
| Perl text file | Sn33R | Shell Programming and Scripting | 5 | 10-31-2003 08:59 AM |
| Perl: taking text from a .txt file | perleo | Shell Programming and Scripting | 2 | 06-19-2003 07:23 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Need help take out few text in perl
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., |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
I'm not sure I understand your request, but here's a first attempt.
Code:
my $remote = $server->[3]; $remote =~ s%.*\.%%; # Remove up to first dot $email_msg .= "Remote ($remote):\n"; |
|
#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. |
|
#4
|
|||
|
|||
|
And for some reason you didn't try the code I posted?
Code:
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$ |
|||
| Google The UNIX and Linux Forums |