in reply to How do I print only some letters of this string
i see two ways to answer this question. you could use a regex:
(assuming the data is in $_):
that expression may need some debugging, but thats the basic idea. $name can be replaced by something to represent the N1B1,etcs. i don't know what that part of the data is so i'm not sure how to represent it in a regex. second option:m/(\d{4}/\d{2}/\d{2}\s*?\d{2}:\d{2}:\d{2}\s*?$name\s*Communications Al +arm\s*Critical|Minor\s*?.{17})/; $data = $1;
again this might need a little tweaking, but thats the basic idea. there are other ways as well, but these are the two that popped into my head.($date, $time, $name, $comm, $alarm, $severity, $data) = split ' ',$_, +7; $data = substr ($data,0,17);
|
---|
Replies are listed 'Best First'. | |
---|---|
RE: RE: How do I print only some letters of this string
by nuance (Hermit) on Jun 21, 2000 at 19:39 UTC | |
by jlistf (Monk) on Jun 21, 2000 at 19:58 UTC |
In Section
Seekers of Perl Wisdom