On a cluster using slurm I am trying to create a list of jobs that were submit in a certain time interval so that I can cancel them.
By hand I can do this using:
sacct --format="JobID,Submit"
which will give me a list JobID's and the corresponding of submission times, in the form:
1919614 2019-04-02T19:31:30
1919615 2019-04-02T19:31:32
1919616 2019-04-02T19:31:33
1919686 2019-04-02T19:47:29
1919687 2019-04-02T19:47:30
1919688 2019-04-02T19:47:32
1919689 2019-04-02T19:47:33
1919690 2019-04-02T19:47:35
1919691 2019-04-02T19:47:36
How do I select JobID's from the first column with date-times in a certain interval in the second column using the command line.
So for example given an interval {2019-04-02T19:47:30,2019-04-02T19:47:33}
it should give
1919687
1919688
1919689
(Or is there a better way to do this altogether.)
I added the awk tag as this question could have been asked without giving any background information on the origin of the string. The question than simply is how to print only the first column if the second column is a date in a certain interval which seems like it should be possible using awk
(I think the background information is important to add in case someone has a better solution using different tools. See XY problem)