Here’s how to get the group of a file, without having to resort to issuing an ls -ltr and then issuing an awk command
stat -c "%G" <your filename goes here>
This would list the file’s group name. No hassles, no complex coding.
Have fun 🙂