I am trying to print out only the lines that begin with Either "Unable to
attach to", OR "Backup of"
and append to the line "NOT OK" or "OK" depending on which match I get
Here is the offending bit of script...

open (FILE, "</path/to/file")or die "can't open file $!";

while (<FILE>){
chomp;
if (m/^Unable to attach to/){
$line .= "$_ \t NOT OK";
}elsif{
(m/^Backup of/){
$line .= "$_ \tOK";
}
}
Print $line;

if I dont chomp $_ then I get the OK/Not OK message on the line below,
if I do use chomp I get the first 7 characters of the Original line then the
"OK/Not Ok" the original line the continues as though the OK/Not OK has
overprinted it!

EG:
Unable to attach to Drive C:
becomes
Unable tNOT OKch to Drive C:

Whereas what I am looking for is:-
 Unable to attach to Drive C:           NOT OK

Hope this makes the problem clearer!

Many thanks for your help


Terry Honeyford

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to