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]
Mikhail,
Thanks moving the separator definition ($/ = '';) *before* the while loop?
worked.
I could not get your one liner to work.
I really appreciate your help.  It has saved me a lot of time and headaches.
I now have a efficient way off adding and removing users from my radius
users file.

-----Original Message-----
From: EMAIL:PROTECTED
[mailto:EMAIL:PROTECTED]On Behalf Of Mikhail Kovalenko
Sent: Monday, April 02, 2001 10:36 PM
To: EMAIL:PROTECTED
Subject: Re: [MLUG] removing a record with a perl script


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/

--
To manage your subscription, go to http://mlug.missouri.edu/members/edit.php

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