On 06/19/2012 04:11 PM, [email protected] wrote:
>
> Hello all,
>
> I imagine there is a way to do this, but I can’t figure it out.
>
> Suppose a user submits 100 jobs, and realizes they want to cancel
> JOBID 1000-1050, but not 1051+. Is there a way to use regular
> expressions (or something) to do so?
>
Hi Adam,
Use bash braces expansion, ie, demonstrating it using "echo":
# echo scancel 1238{2,6,7}
scancel 12382 12386 12387
bad:
# echo scancel 10{00..50}
scancel 100 101 102 103 104 105 106 107 108 109 1010 1011 1012 1013 1014
1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028
1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042
1043 1044 1045 1046 1047 1048 1049 1050
good:
# echo scancel {1000..1050}
scancel 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012
1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026
1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040
1041 1042 1043 1044 1045 1046 1047 1048 1049 1050
if not using bash:
# echo scancel `seq 1000 1050`
scancel 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012
1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026
1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040
1041 1042 1043 1044 1045 1046 1047 1048 1049 1050
Etc ..
Good luck
> I tried:
>
> scancel 1238[6-7]
>
> scancel: error: Invalid job ID 1238[6-7]
>
> scancel "1238[6-7]"
>
> scancel: error: Invalid job ID 1238[6-7]
>
> For the following jobs:
>
> JOBID USER START_TIME NAME CPUS TIME
> STATE
>
> 12386 amarko 2012-06-19T14:42:42 sleep 1 1:19
> RUNNING
>
> 12387 amarko 2012-06-19T14:42:42 sleep 1 1:19
> RUNNING
>
> 12385 amarko 2012-06-19T14:42:41 sleep 1 1:20
> RUNNING
>
> 12384 amarko 2012-06-19T14:42:39 sleep 1 1:22
> RUNNING
>
> Thanks,
>
> Adam Marko
>
> ------------------------------
>
> Adam C. Marko
>
> Bioinformatics Analyst III
>
> Asuragen, Inc <http://www.asuragen.com/>
>
> 512-681-5303
>
--
-----------------------------------------------------------
Michel Bourget - SGI - Linux Software Engineering
"Past BIOS POST, everything else is extra" (travis)
-----------------------------------------------------------