Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Help asked for creating a file with usernames

by jethro (Monsignor)
on Feb 09, 2013 at 14:19 UTC ( #1017963=note: print w/ replies, xml ) Need Help??


in reply to Help asked for creating a file with usernames

Well, generally perlmonks isn't a code-writing service, but since this is rather trivial, here is the one-liner you could use:

perl -pi'.orig' -e 's/^radiusFramedAddress:\s* ([\d\.]*)/changeType: m +odify\nreplace: radiusFramedAddress\nradiusFramedAddress: $1\/32/' us +ers.txt

It uses a regular expression (regexp) to substitute every line beginning with 'radiusFr...' with the three lines ou want. $1 inserts the ip-adress captured in the pattern through the ()

Just execute this on a command line (as one single line wihtout the '+' chars) and you are finished. The original file is replaced and changed, the old contents is in users.txt.orig. Tested it on linux. If you are on windows, it should work too, but I can't guarantee (but there shouldn't be anything catastrophic happening)


Comment on Re: Help asked for creating a file with usernames
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1017963]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2014-09-16 16:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (36 votes), past polls