[TriLUG] Scripting question - better answer

Jeremy Portzer jeremyp at pobox.com
Thu Jan 9 16:45:18 EST 2003


On Thu, 2003-01-09 at 16:36, Jeremy Portzer wrote:
> 
> What format is "the-stuff-we-dont-want" in?   A list of usernames?   The
> following pipeline should list the homedirectories without a loop at
> all:
> 
> egrep -v "^(root|adm|daemon|other|bad|users):" /etc/passwd | 
> awk -F: '{print $6}'

Or here's an even simpler way of doing this.  If all regular users have
user ID's greater than 500, the following awk line will print out the
regular users' home directories:
	awk -F: '{if ($3 > 500) print $6}' /etc/passwd

Hope this helps,

Jeremy





More information about the TriLUG mailing list