Ask Your Question

Can Puppet sort /etc/passwd by UID?

asked 2013-10-25 15:12:11 -0600

Rodney gravatar image

Is there a way in Puppet to have it sort the contents of /etc/passwd by UID?

Or username. It'd be handy to be able to sort /etc/group (by gid) as well.

Just something to have as a shortcut. If the solution is rather complicated I just stick to sorting as needed.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-10-25 19:03:44 -0600

timelord gravatar image

I am not sure what you're trying to achieve, but maybe this helps:


  • sorting by UID: sort -n -t ':' -k3,3 /etc/passwd
  • sorting by username: sort -t ':' -k1,1 /etc/passwd


  • sorting by GID: sort -n -t ':' -k3,3 /etc/group
  • sorting by groupname: sort -t ':' -k1,1 /etc/group
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-10-25 15:12:11 -0600

Seen: 377 times

Last updated: Oct 25 '13