Remove jobs from at queue on a specified date

The name of the pictureThe name of the pictureThe name of the pictureClash 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?










share|improve this question









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.























    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?










    share|improve this question









    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.





















      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?










      share|improve this question









      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






      share|improve this question









      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.











      share|improve this question









      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.









      share|improve this question




      share|improve this question








      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.




















          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 from atq 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' ' '





          share|improve this answer



























            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.






            share|improve this answer






















              Your Answer







              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "106"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              convertImagesToLinks: false,
              noModals: false,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );






              Sawajiri is a new contributor. Be nice, and check out our Code of Conduct.









               

              draft saved


              draft discarded


















              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






























              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 from atq 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' ' '





              share|improve this answer
























                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 from atq 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' ' '





                share|improve this answer






















                  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 from atq 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' ' '





                  share|improve this answer












                  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 from atq 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' ' '






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 4 hours ago









                  Fiximan

                  3,133524




                  3,133524






















                      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.






                      share|improve this answer


























                        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.






                        share|improve this answer
























                          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.






                          share|improve this answer














                          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.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited 4 hours ago

























                          answered 4 hours ago









                          Kusalananda

                          112k15216344




                          112k15216344




















                              Sawajiri is a new contributor. Be nice, and check out our Code of Conduct.









                               

                              draft saved


                              draft discarded


















                              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.













                               


                              draft saved


                              draft discarded














                              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













































































                              Comments

                              Popular posts from this blog

                              List of Gilmore Girls characters

                              What does second last employer means? [closed]

                              One-line joke