rrdavis already provided the resource I always point people to when they need help with the variables. Here it is again
viewtopic.php?f=8&t=1959
In that post, the variables are arranged by which scripting area they may be used. Attempting to use them outside of those specific areas has, in my experience, not worked.
If you need to use variables such as these in other places, you can parse them from the g-code itself in an external script that can be called from the terminal commands for post processing area.