Since you didnt mentioned what you tried, i will take it as after a small guidance you would try it yourself by looking into some examples:
So i would prefer something like :
#declare filename as variable $filename
#read a variable say $inputname
#use grep to fetch users all details, instead of using cat. Avoiding a useless use of commands
grep $inputname $filename
#you can use awk, cut and further more commandsdepending upon your requirement, see man pages and examples as 'pan64' told.
#if there is any iteration needed you can use while loop to do the due
while read $variable; do something_with_variable;done< $filename
let us know if you ty and fail with what you tried, we can help suggesting better option.