HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
cancel
Showing results for 
Search instead for 
Did you mean: 

Silly easy one

 
SOLVED
Go to solution
Adam W.
Valued Contributor

Silly easy one

How would I search /etc/passwd and print only the usernames to the screen?
There are two types of people in the world, Marines and those who wish they were.
5 REPLIES
Steven E. Protter
Exalted Contributor
Solution

Re: Silly easy one

Shalom,

cat /etc/passwd | awk -F: '{ print $1 }'

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
James R. Ferguson
Acclaimed Contributor

Re: Silly easy one

Hi Adam:

One way:

# awk -F: '{print $1}' /etc/passwd

Regards!

...JRF...
Adam W.
Valued Contributor

Re: Silly easy one

Thanks Guys Cheers!
There are two types of people in the world, Marines and those who wish they were.
James R. Ferguson
Acclaimed Contributor

Re: Silly easy one

Hi (again):

Mind you, the 'cat' is a waste of a process!

Regards!

...JRF...
Michael Mike Reaser
Valued Contributor

Re: Silly easy one

cut -f1 -d: /etc/passwd
There's no place like 127.0.0.1

HP-Server-Literate since 1979