wmctrl -lp | awk '/Firefox/ { print $1 }'
No grep needed. Awk will do it. Also, the default field separator is a space, so it does not need to be specified. Also, use single quotes around your awk script, so the shell does not extend $ 1. This is why your script crashed. $ 1 turned into nothing, and your awk action became a βprintβ that prints the entire line.