Skip to content

Instantly share code, notes, and snippets.

@mej
Last active August 29, 2015 14:27
Show Gist options
  • Save mej/881bee1fe84b8e94da60 to your computer and use it in GitHub Desktop.
Save mej/881bee1fe84b8e94da60 to your computer and use it in GitHub Desktop.
[P1L] Alphabetize non-system group members in /etc/group (in-place edit)
perl -ni.presort -e '@F = split /:/; $F[3] = join(",", sort(grep{$_}split(",", (chomp($F[3]),$F[3]))))."\n" if ($F[2] >= 100); print join(":", @F);' /etc/group
@mej
Copy link
Author

mej commented Aug 13, 2015

This PERL 1-liner (P1L) will alphabetize the list of group members for all groups in /etc/group with GID >= 100.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment