Hi,
I have problems in unless condition because of which I am not getting the desired output. This is as per my analysis but my code may have some other issues also which can be surely pointed out here to get the desired output. I am getting the output as below.
Memory
Network Port
Physical Cpu
Virtual Disk
Group Cpu
My desired output is as below.
Memory
Physical Cpu
Can somebody let me know what am I missing?
Also, as this is my first post here, please bare with my style of putting up question.
foreach my $line (@::FileLines) {
unless(grep(/$pattern/,$line)){
my @karatSplit = split('\^', $line);
print "$karatSplit[1]\n";
}
}
@::FileLines contains lines from a txt file as below.
Memory^Memory^Free MBytes,80124,85490,81912.39,100,
Alert,Migrate high memory consuming VM to another host.^M
DvsPortset-0:130066:Win2k3_test (e4ba25c7-5628-45d8-97a7-83331e7ad7e1)^Network Port^% Outbound Packets Dropped,0.00,0.00,0,0,OK,
DvsPortset-0:130066:Win2k3_test (e4ba25c7-5628-45d8-97a7-83331e7ad7e1)^Network Port^% Received Packets Dropped,0.00,0.00,0,0,OK,
_Total)^Physical Cpu^% Processor Time,0.63,13.49,6.27,0,OK,
Win2k3_test (e4ba25c7-5628-45d8-97a7-83331e7ad7e1)^Virtual Disk^Commands/sec,0.00,6.72,2,0,OK,
iserver6 (b93b57e2-ab74-441a-98a7-35dc71feca12)^Virtual Disk^Writes/sec,0.00,21.26,1.63,0,OK,
iserver7 (035e60d4-3073-4fcc-a78e-6a718b3b502f)^Virtual Disk^Commands/sec,0.00,104.15,18.96,0.49,OK,
Win2k8_Trace_db^Group Cpu^% Used,0.55,8.88,4.07,0,OK,
$pattern is like below
$pattern = Win2k8_Trace_db|Win2k3_test (e4ba25c7-5628-45d8-97a7-83331e7ad7e1)|iserver7 (035e60d4-3073-4fcc-a78e-6a718b3b502f)|iserver6 (b93b57e2-ab74-441a-98a7-35dc71feca12)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.