Skip to main content
deleted 56 characters in body
Source Link
ilkkachu
  • 148.1k
  • 16
  • 268
  • 441

As @JeffSchaller says, awk is the tool for the job and since OP wants regex we can just combine the two

awk -F: '$4 ~ /^100[13]$/' mypasswd

and that allows a little golf putt on the grep version

grep -E "^(.*:){3}100[13]:" mypasswd

Edit

Anchored in accordance with @ikkachu comment

As @JeffSchaller says, awk is the tool for the job and since OP wants regex we can just combine the two

awk -F: '$4 ~ /^100[13]$/' mypasswd

and that allows a little golf putt on the grep version

grep -E "^(.*:){3}100[13]:" mypasswd

Edit

Anchored in accordance with @ikkachu comment

As @JeffSchaller says, awk is the tool for the job and since OP wants regex we can just combine the two

awk -F: '$4 ~ /^100[13]$/' mypasswd

and that allows a little golf putt on the grep version

grep -E "^(.*:){3}100[13]:" mypasswd
As per @ikkachu critique
Source Link
bu5hman
  • 4.9k
  • 2
  • 16
  • 29

As @JeffSchaller says, awk is the tool for the job and since OP wants regex we can just combine the two

awk -F: '$4 ~ /100[13]^100[13]$/' mypasswd

and that allows a little golf putt on the grep version

grep -E "^(.*:){3}100[13]"100[13]:" mypasswd

Edit

Anchored in accordance with @ikkachu comment

As @JeffSchaller says, awk is the tool for the job and since OP wants regex we can just combine the two

awk -F: '$4 ~ /100[13]/' mypasswd

and that allows a little golf putt on the grep version

grep -E "^(.*:){3}100[13]" mypasswd

As @JeffSchaller says, awk is the tool for the job and since OP wants regex we can just combine the two

awk -F: '$4 ~ /^100[13]$/' mypasswd

and that allows a little golf putt on the grep version

grep -E "^(.*:){3}100[13]:" mypasswd

Edit

Anchored in accordance with @ikkachu comment

added 103 characters in body
Source Link
bu5hman
  • 4.9k
  • 2
  • 16
  • 29

As @JeffSchaller says, awk is the tool for the job and since OP wants regex we can just combine the two

awk -F: '$4 ~ /100[13]/' mypasswd

and that allows a little golf putt on the grep version

grep -E "^(.*:){3}100[13]" mypasswd

As @JeffSchaller says, awk is the tool for the job and since OP wants regex we can just combine the two

awk -F: '$4 ~ /100[13]/' mypasswd

As @JeffSchaller says, awk is the tool for the job and since OP wants regex we can just combine the two

awk -F: '$4 ~ /100[13]/' mypasswd

and that allows a little golf putt on the grep version

grep -E "^(.*:){3}100[13]" mypasswd
Source Link
bu5hman
  • 4.9k
  • 2
  • 16
  • 29
Loading