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

Re: Golf: reverse sort /etc/passwd by UID

by tobyink (Abbot)
on Feb 06, 2013 at 10:23 UTC ( #1017376=note: print w/replies, xml ) Need Help??


in reply to Golf: reverse sort /etc/passwd by UID

OK, using salva's wonderful Sort::Key, I can go five characters shorter...

perl -MSort::Key=rikeysort -e'print rikeysort{/(\d+)/;$1}<>' /etc/pass +wd

If you don't mind a spurious blank line at the end of the output, then it's easy to drop another two characters...

perl -MSort::Key=rikeysort -E'say rikeysort{/(\d+)/;$1}<>' /etc/passwd
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1017376]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2017-01-24 14:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (205 votes). Check out past polls.