Remove jobs from at queue on a specified date
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I have a series of pending jobs in the queue,
$ atq
8 Mon Oct 29 13:21:00 2018
5 Mon Oct 29 10:36:00 2018
15 Mon Oct 29 13:31:00 2018
4 Mon Oct 29 10:35:00 2018
18 Mon Oct 29 15:55:00 2018
3 Mon Oct 29 10:31:00 2018
16 Mon Oct 29 15:54:00 2018
11 Mon Oct 29 13:24:00 2018
12 Mon Oct 29 13:24:00 2018
17 Mon Oct 29 15:53:00 2018
10 Mon Oct 29 13:23:00 2018
19 Tue Oct 30 15:43:00 2018
2 Mon Oct 29 07:41:00 2018
6 Mon Oct 29 10:41:00 2018
7 Mon Oct 29 13:20:00 2018
9 Mon Oct 29 13:22:00 2018
and plan to remove them job on Oct 29. Fortunately, atrm could remove multiple jobs
atrm 8 5 15 4
despite this, a iteration might be a better solution,
$ atq | grep "Oct 29"
18 Mon Oct 29 15:55:00 2018
3 Mon Oct 29 10:31:00 2018
16 Mon Oct 29 15:54:00 2018
11 Mon Oct 29 13:24:00 2018
12 Mon Oct 29 13:24:00 2018
17 Mon Oct 29 15:53:00 2018
10 Mon Oct 29 13:23:00 2018
2 Mon Oct 29 07:41:00 2018
6 Mon Oct 29 10:41:00 2018
7 Mon Oct 29 13:20:00 2018
9 Mon Oct 29 13:22:00 2018
How could I select the first field of the job number so as to iterating them?
scripting at
New contributor
Sawajiri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
1
down vote
favorite
I have a series of pending jobs in the queue,
$ atq
8 Mon Oct 29 13:21:00 2018
5 Mon Oct 29 10:36:00 2018
15 Mon Oct 29 13:31:00 2018
4 Mon Oct 29 10:35:00 2018
18 Mon Oct 29 15:55:00 2018
3 Mon Oct 29 10:31:00 2018
16 Mon Oct 29 15:54:00 2018
11 Mon Oct 29 13:24:00 2018
12 Mon Oct 29 13:24:00 2018
17 Mon Oct 29 15:53:00 2018
10 Mon Oct 29 13:23:00 2018
19 Tue Oct 30 15:43:00 2018
2 Mon Oct 29 07:41:00 2018
6 Mon Oct 29 10:41:00 2018
7 Mon Oct 29 13:20:00 2018
9 Mon Oct 29 13:22:00 2018
and plan to remove them job on Oct 29. Fortunately, atrm could remove multiple jobs
atrm 8 5 15 4
despite this, a iteration might be a better solution,
$ atq | grep "Oct 29"
18 Mon Oct 29 15:55:00 2018
3 Mon Oct 29 10:31:00 2018
16 Mon Oct 29 15:54:00 2018
11 Mon Oct 29 13:24:00 2018
12 Mon Oct 29 13:24:00 2018
17 Mon Oct 29 15:53:00 2018
10 Mon Oct 29 13:23:00 2018
2 Mon Oct 29 07:41:00 2018
6 Mon Oct 29 10:41:00 2018
7 Mon Oct 29 13:20:00 2018
9 Mon Oct 29 13:22:00 2018
How could I select the first field of the job number so as to iterating them?
scripting at
New contributor
Sawajiri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have a series of pending jobs in the queue,
$ atq
8 Mon Oct 29 13:21:00 2018
5 Mon Oct 29 10:36:00 2018
15 Mon Oct 29 13:31:00 2018
4 Mon Oct 29 10:35:00 2018
18 Mon Oct 29 15:55:00 2018
3 Mon Oct 29 10:31:00 2018
16 Mon Oct 29 15:54:00 2018
11 Mon Oct 29 13:24:00 2018
12 Mon Oct 29 13:24:00 2018
17 Mon Oct 29 15:53:00 2018
10 Mon Oct 29 13:23:00 2018
19 Tue Oct 30 15:43:00 2018
2 Mon Oct 29 07:41:00 2018
6 Mon Oct 29 10:41:00 2018
7 Mon Oct 29 13:20:00 2018
9 Mon Oct 29 13:22:00 2018
and plan to remove them job on Oct 29. Fortunately, atrm could remove multiple jobs
atrm 8 5 15 4
despite this, a iteration might be a better solution,
$ atq | grep "Oct 29"
18 Mon Oct 29 15:55:00 2018
3 Mon Oct 29 10:31:00 2018
16 Mon Oct 29 15:54:00 2018
11 Mon Oct 29 13:24:00 2018
12 Mon Oct 29 13:24:00 2018
17 Mon Oct 29 15:53:00 2018
10 Mon Oct 29 13:23:00 2018
2 Mon Oct 29 07:41:00 2018
6 Mon Oct 29 10:41:00 2018
7 Mon Oct 29 13:20:00 2018
9 Mon Oct 29 13:22:00 2018
How could I select the first field of the job number so as to iterating them?
scripting at
New contributor
Sawajiri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I have a series of pending jobs in the queue,
$ atq
8 Mon Oct 29 13:21:00 2018
5 Mon Oct 29 10:36:00 2018
15 Mon Oct 29 13:31:00 2018
4 Mon Oct 29 10:35:00 2018
18 Mon Oct 29 15:55:00 2018
3 Mon Oct 29 10:31:00 2018
16 Mon Oct 29 15:54:00 2018
11 Mon Oct 29 13:24:00 2018
12 Mon Oct 29 13:24:00 2018
17 Mon Oct 29 15:53:00 2018
10 Mon Oct 29 13:23:00 2018
19 Tue Oct 30 15:43:00 2018
2 Mon Oct 29 07:41:00 2018
6 Mon Oct 29 10:41:00 2018
7 Mon Oct 29 13:20:00 2018
9 Mon Oct 29 13:22:00 2018
and plan to remove them job on Oct 29. Fortunately, atrm could remove multiple jobs
atrm 8 5 15 4
despite this, a iteration might be a better solution,
$ atq | grep "Oct 29"
18 Mon Oct 29 15:55:00 2018
3 Mon Oct 29 10:31:00 2018
16 Mon Oct 29 15:54:00 2018
11 Mon Oct 29 13:24:00 2018
12 Mon Oct 29 13:24:00 2018
17 Mon Oct 29 15:53:00 2018
10 Mon Oct 29 13:23:00 2018
2 Mon Oct 29 07:41:00 2018
6 Mon Oct 29 10:41:00 2018
7 Mon Oct 29 13:20:00 2018
9 Mon Oct 29 13:22:00 2018
How could I select the first field of the job number so as to iterating them?
scripting at
scripting at
New contributor
Sawajiri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Sawajiri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 3 hours ago


Jeff Schaller
34.7k952115
34.7k952115
New contributor
Sawajiri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 4 hours ago
Sawajiri
925
925
New contributor
Sawajiri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Sawajiri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Sawajiri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
2
down vote
accepted
You could just pipe the atq
output and process it a bit:
atrm $( atq | grep 'Oct 29' | cut -d' ' -f 1 | tr 'n' ' ' )
What is being done:
- grep
Oct 29
fromatq
output - select the first fields only using
cut
and assuming a space as separator - make newlines to spaces using
tr
This gives you just the job numbers of at
on a single line which then can be your input for atrm
.
Pretest the selection by listing the job IDs only with just using
atq | grep 'Oct 29' | cut -d' ' -f 1 | tr 'n' ' '
add a comment |Â
up vote
3
down vote
atq | awk '/Oct 29/ print $1 '
This would print the job IDs of the jobs that contain the string Oct 29
. Passing this to xargs atrm
would remove the jobs:
atq | awk '/Oct 29/ print $1 ' | xargs atrm
The xargs
utility reads from its standard input stream and executes the given utility with the argument read. If there are many arguments (probably not in this case), xargs
may execute the utility multiple times.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
You could just pipe the atq
output and process it a bit:
atrm $( atq | grep 'Oct 29' | cut -d' ' -f 1 | tr 'n' ' ' )
What is being done:
- grep
Oct 29
fromatq
output - select the first fields only using
cut
and assuming a space as separator - make newlines to spaces using
tr
This gives you just the job numbers of at
on a single line which then can be your input for atrm
.
Pretest the selection by listing the job IDs only with just using
atq | grep 'Oct 29' | cut -d' ' -f 1 | tr 'n' ' '
add a comment |Â
up vote
2
down vote
accepted
You could just pipe the atq
output and process it a bit:
atrm $( atq | grep 'Oct 29' | cut -d' ' -f 1 | tr 'n' ' ' )
What is being done:
- grep
Oct 29
fromatq
output - select the first fields only using
cut
and assuming a space as separator - make newlines to spaces using
tr
This gives you just the job numbers of at
on a single line which then can be your input for atrm
.
Pretest the selection by listing the job IDs only with just using
atq | grep 'Oct 29' | cut -d' ' -f 1 | tr 'n' ' '
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
You could just pipe the atq
output and process it a bit:
atrm $( atq | grep 'Oct 29' | cut -d' ' -f 1 | tr 'n' ' ' )
What is being done:
- grep
Oct 29
fromatq
output - select the first fields only using
cut
and assuming a space as separator - make newlines to spaces using
tr
This gives you just the job numbers of at
on a single line which then can be your input for atrm
.
Pretest the selection by listing the job IDs only with just using
atq | grep 'Oct 29' | cut -d' ' -f 1 | tr 'n' ' '
You could just pipe the atq
output and process it a bit:
atrm $( atq | grep 'Oct 29' | cut -d' ' -f 1 | tr 'n' ' ' )
What is being done:
- grep
Oct 29
fromatq
output - select the first fields only using
cut
and assuming a space as separator - make newlines to spaces using
tr
This gives you just the job numbers of at
on a single line which then can be your input for atrm
.
Pretest the selection by listing the job IDs only with just using
atq | grep 'Oct 29' | cut -d' ' -f 1 | tr 'n' ' '
answered 4 hours ago
Fiximan
3,133524
3,133524
add a comment |Â
add a comment |Â
up vote
3
down vote
atq | awk '/Oct 29/ print $1 '
This would print the job IDs of the jobs that contain the string Oct 29
. Passing this to xargs atrm
would remove the jobs:
atq | awk '/Oct 29/ print $1 ' | xargs atrm
The xargs
utility reads from its standard input stream and executes the given utility with the argument read. If there are many arguments (probably not in this case), xargs
may execute the utility multiple times.
add a comment |Â
up vote
3
down vote
atq | awk '/Oct 29/ print $1 '
This would print the job IDs of the jobs that contain the string Oct 29
. Passing this to xargs atrm
would remove the jobs:
atq | awk '/Oct 29/ print $1 ' | xargs atrm
The xargs
utility reads from its standard input stream and executes the given utility with the argument read. If there are many arguments (probably not in this case), xargs
may execute the utility multiple times.
add a comment |Â
up vote
3
down vote
up vote
3
down vote
atq | awk '/Oct 29/ print $1 '
This would print the job IDs of the jobs that contain the string Oct 29
. Passing this to xargs atrm
would remove the jobs:
atq | awk '/Oct 29/ print $1 ' | xargs atrm
The xargs
utility reads from its standard input stream and executes the given utility with the argument read. If there are many arguments (probably not in this case), xargs
may execute the utility multiple times.
atq | awk '/Oct 29/ print $1 '
This would print the job IDs of the jobs that contain the string Oct 29
. Passing this to xargs atrm
would remove the jobs:
atq | awk '/Oct 29/ print $1 ' | xargs atrm
The xargs
utility reads from its standard input stream and executes the given utility with the argument read. If there are many arguments (probably not in this case), xargs
may execute the utility multiple times.
edited 4 hours ago
answered 4 hours ago


Kusalananda
112k15216344
112k15216344
add a comment |Â
add a comment |Â
Sawajiri is a new contributor. Be nice, and check out our Code of Conduct.
Sawajiri is a new contributor. Be nice, and check out our Code of Conduct.
Sawajiri is a new contributor. Be nice, and check out our Code of Conduct.
Sawajiri is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f478605%2fremove-jobs-from-at-queue-on-a-specified-date%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password