Linux - How to list all users
awk -F: '$0=$1 " uid="$3' /etc/passwd
awk is easier in this case.
-F defines field separator as :
so you want is 1st and 3rd colums. so build the $0
to provide your output format.
this is very basic usage of powerful awk. you may want to read some tutorials if you faced this kind of problem often.
This time you got fish, if I were you, I am gonna do some research on how to fishing.
cut
is nice for this:
cut -d: -f1 /etc/passwd
This means "cut, using :
as the delimeter, everything except the first field from each line of the /etc/passwd
file".
I think best option is as that:
grep "/bin/bash" /etc/passwd | cut -d':' -f1