On Sat, 2019-08-17 at 09:06 +0200, Michał Górny wrote:
> Hi,
> 
> Here's v2 of my proposed format.

Also example usage:

get user/group named 'adm'

  $ awk '$1 == "adm"' uid-gid.txt 
  adm           3       4       baselayout

get records for UID 3:

  $ awk '$2 == 3' uid-gid.txt 
  adm           3       4       baselayout
  bin           3       7       baselayout-fbsd

get records for GID 4:

  $ awk '$3 == 4' uid-gid.txt 
  adm           3       4       baselayout
  tty           4       4       baselayout-fbsd

get all users, sorted by UID:

  $ awk '$0 ~ /^[^#]/ && $2 != "-"' uid-gid.txt  | sort -k2 -n
  root          0       0       baselayout
  root          0       -       baselayout-fbsd
  toor          0       -       baselayout-fbsd FreeBSD lists both names in 
passwd

get all groups, sorted by GID:

  $ awk '$0 ~ /^[^#]/ && $3 != "-"' uid-gid.txt  | sort -k3 -n
  root          0       0       baselayout
  wheel         -       0       baselayout-fbsd
  bin           1       1       baselayout

-- 
Best regards,
Michał Górny

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to