Thursday 29 August 2013

Bash/command line - Count occurances of string in output from qstat

Bash/command line - Count occurances of string in output from qstat

I am trying to write a line of shell code that will tell me how many jobs
I have in a queue.
The command qstat will return a list of jobs with the following attribute
Job id, Name, User, Time Use Queue name
The command is labelled qstat(1B) in the man page.
My attempt to count how many jobs I have running uses grep:
grep -c my_username | qstat
As I understand it, this should count the number of occurrences of
my_username in the output from qstat. It doesn't work though. Any ideas
where I am going wrong?

No comments:

Post a Comment