title: Cancel jobs submitted previous to a date or with JOBID lower than a given integer
body: <p>I have realized that the jobs submitted with a previous version of my software are useless because of a bug, so I want to cancel them. However, I also have newer jobs that I would like to keep running. All the jobs have the same job name and are running in the same partition.</p>
  <p>I have written the following script to cancel the jobs with an ID lower than a given one.</p>
  <pre><code>#!\bin\bash
  
  if [ $1 ]
  then
      MAX_JOBID=$1
  else
      echo &quot;An integer value is needed&quot;
      exit
  fi
  
  JOBIDLIST=$(squeue -u $USER -o &quot;%F&quot;)
  
  for JOBID in $JOBIDLIST
  do
      if [ &quot;$JOBID&quot; -lt &quot;$MAX_JOBID&quot; ]
      then
          echo &quot;Cancelling job &quot;$JOBID
          scancel $JOBID
      fi
  done
  </code></pre>
  <p>I would say that this is a recurrent situation for someone developing a software and I wonder if there is a direct way to do it using slurm commands. Alternatively, do you use some tricks like appending the software commit ID to the job name to overcome this kind of situations?</p>