Here is the issue, I would like to count the number of jobs I have in the hpc, but it is not one of the readily provided features. So I made this simple script
squeue -u user_name | wc -l
where squeue
prints all the jobs like the following
> squeue -u user_name
JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON)
8840441 theory cteq fxm PD 0:00 1 (Resources)
8840442 theory cteq fxm PD 0:00 1 (Priority)
8840443 theory cteq fxm PD 0:00 1 (Priority)
8840444 theory cteq fxm PD 0:00 1 (Priority)
which would be piped to wc
and the number of lines would be counted. However, the first line is not an entry of the job. How may I instruct wc
to skip the first line when counting? Or should I just take the output of wc
and minus one to it?
Thanks in advance!
squeue -u user_name | sed '1d' | wc -l
. Although, there are many very nice solutions in the answers of this question.