It seems simple. I need to query the state of a specific job (running, queued, etc). qstat -j does not provide the information even with -f. It seems the only way is to do qstat | grep job_id. I need to be able to parse the output with a script. Is there a way to do this?
Running SGE 6.2u5
unfortunately there is no command that will give you just a single output with the state of a given job. This information would have to be parsed from the output of qstat. As you suggested in your post, qstat | grep job_id is probably the best way of getting that information for a specific job.