So, are you just trying to get a list of all users from / etc / passwd? If so, I believe this would be a simpler solution:
cut -d":" -f1 /etc/passwd
Edit:
If you only need a list of user users (not system users), you can use one of them:
grep -E ":[0-9]{4,6}:[0-9]{4,6}:" /etc/passwd | cut -d: -f1
^ It is assumed that your system uses 1000 and above for UID and GID for user users
grep /home /etc/passwd | cut -d: -f1
^ It is assumed that each user has a home directory.
Other solutions depend on more detailed criteria and system settings.
mart1n
source share