Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://599427]
[choroba]: also, seeing communist propaganda I remember from my childhood... very strange experience
[LanX]: ha the Cuban experience

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2017-02-26 04:46 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (371 votes). Check out past polls.