Filtering / etc / passwd on Unix
1 answer
This is an easy way to do it:
awk -F: '$3 > 999' /etc/passwd
In this case it is used awk
with a field separator :
and instructs it to print a line if the third field is greater than 999. If you only want to print the first field (username), or plot multiple new lines based on fields, this is the starting point:
awk -F: '{if ($3 > 999) print "user", $1, "uid", $3}' /etc/passwd
+8
source to share