Sample Header Ad - 728x90

How to skip the first line of my output?

15 votes
4 answers
42592 views
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!
Asked by zyy (321 rep)
Jan 10, 2020, 04:04 AM
Last activity: Oct 17, 2024, 03:26 PM