How could I use the
cut
command to extract a list of usernames and login shells from the /etc/passwd
file, where the resulting usernames and login shells are separated by a single space?
Sort the resulting list in ascending alphabetical order, using the login shell as the primary key, and the username as a secondary key. Store the result in the newly created file ~/usershells.txt
.
This is the command I attempted:
cut -d /etc/passwd -k7 -k1 | sort > ~/usershells.txt
Asked by user72510
(513 rep)
Jul 15, 2014, 09:31 PM
Last activity: Nov 23, 2023, 10:19 AM
Last activity: Nov 23, 2023, 10:19 AM