MLUG: Re: [MLUG] removing a record with a perl script
Re: [MLUG] removing a record with a perl script
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Mark Taylor wrote:
> 
> This little splice of code works except that if you are removing a user that
> happens to be at the top of the users file.  It will remove the user name
> and password but will not remove "User-Service-Type = Framed-User," or
> "Framed-Protocol = PPP" from the users record what is it that I need to fix
> in this section of code?
> 
> while (<OLD>) {
>         $/ = '';
>         if (/$name/) {
>           next if /$passwd/;
>         }# end if
>         (print NEW $_)          || die "can't write to $new: $!";
> }#end while

What happens when you move the separator definition ($/ = '';) *before*
the while loop?

BTW did my one-liner not work for you? It still works for me, even in
this case, *if* you add an empty line to the beginning of your users
file :)

-- MK

<< Terra es et in terram ibis >>
--
To manage your subscription, go to http://mlug.missouri.edu/members/edit.php

Archives are available at http://mlug.missouri.edu/list-archives/