I am unsure about your intend to remove leading _ this might lead to chown: _user not found when chowning
try
awk -F: '/^#/ { next } {printf "chown %s \"%s\"\n",$1,$6} ' my_etc_passwd
where
-F:tell awk to use:as separator/^#/ { next }skip line starting with#- likewise add
/^_/ { next }to skip line starting with_(if need be) - next pattern/action print chown command.
If result look OK, just pipe to bash