- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Perl equivalent needed
Operating System - HP-UX
1748022
Members
5332
Online
108757
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2011 03:32 PM
04-20-2011 03:32 PM
Re: Perl equivalent needed
Tried $_ but I am not getting what I want.
Thanks,
Allan.
Thanks,
Allan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2011 03:34 PM
04-20-2011 03:34 PM
Re: Perl equivalent needed
Hmmm, not sure exactly what you want, and not sure what you tried with $_ but maybe this helps?
To attach all the original message lines you basically have 2 choices.
1) stash them all in an array as you process, then print that array after printing the headlines.
2) after gathering and printing the headlines, re-read the source and print to log
1)
while(
push @everything, $_;
chomp;
$app = $1 if /Appname:(.*)/;
$host = $1 if /^Host:(.*)/;
if (/Date\/Time:(.*)/) { printf FW "%s:%s:%s\n",$app,$host,$1; }
}
print FW @everything;
$cmd='mail ...
2)
while(
chomp;
$app = $1 if /Appname:(.*)/;
$host = $1 if /^Host:(.*)/;
if (/Date\/Time:(.*)/) { printf FW "%s:%s:%s\n",$app,$host,$1; }
}
seek FH,0,0; # back to the beginning
print FW
$cmd='mail...
my tests....
# cat x.txt
aap
test: xxx
noot
test: yyy
mies
1) # perl -e "open X,qq(
2) # perl -e 'open X,qq(
both giving:
test: xxx
test: yyy
aap
test: xxx
noot
test: yyy
mies
Good luck!
Hein
- « Previous
-
- 1
- 2
- Next »
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP