use warnings; use strict; use File::Slurp; my $file = '/etc/passwd'; my @lines = read_file($file); chomp @lines; my @sorted = map {$_->[0]} sort {$a->[1] <=> $b->[1] || $a->[1] cmp $b->[1]} map {[$_,(split':')[0]]} @lines; print "$_\n" for @sorted;
In reply to Re: Sort passwd by UID
by toolic
in thread Sort passwd by UID
by Saved
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |