On Fri, 25 Jan 2002, IT Workflow - Terry Honeyford wrote:
> 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!
Just append "\n" to the line when you print it.
-- Brett
http://www.chapelperilous.net/
------------------------------------------------------------------------
Is there life before breakfast?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]