Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Defactor this code

by sfink (Deacon)
on Feb 11, 2007 at 04:57 UTC ( #599427=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    perl -i.old -lne 'if (/^[\s#]*Port/i) { print "Port 1234" unless $done
    +++ } else { print }' sshd_config
    
  2. or download this
    perl -i.old -lne 'print unless /^[\s#]*Port/i; END{print "Port 1234"}'
    + sshd_config
    
  3. or download this
    PORT=1234 perl -i.old -lne 'print unless /^[\s#]*Port/i; END { print "
    +Port $ENV{PORT}" }' sshd_config
    
  4. or download this
    perl -i.old -lne 'BEGIN { $sshport = pop }; print unless /^[\s#]*Port/
    +i; END { print "Port $sshport" }' sshd_config 1234
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2014-09-20 23:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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











    Results (163 votes), past polls