Extract lines containing certain value or greater

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I am working with a log file that contains entries that appear like this:



$Hostname1: 0x7FDBF4B1AB10 ( 23698) waiting 100 seconds, NSDThread: for I/O completion on disk vd4
$Hostname2: 0x7F2D10A2F8C0 ( 25393) waiting 200 seconds, NSDThread: for I/O completion on disk vd35
$Hostname3: 0x7F2D109F4290 ( 25343) waiting 900 seconds, NSDThread: for I/O completion on disk vd11
$Hostname4: 0x7FDBF4B1AB30 ( 23698) waiting 100 seconds, NSDThread: for I/O completion on disk vd40
$Hostname5: 0x7F2D10A2F830 ( 25392) waiting 750 seconds, NSDThread: for I/O completion on disk vd13
$Hostname6: 0x7F2D109F4240 ( 25342) waiting 500 seconds, NSDThread: for I/O completion on disk vd14


I would like to filter the lines where the wait time is greater than an arbitrary value (let's say 600 seconds). What's the best way to do this in bash?










share|improve this question



























    up vote
    1
    down vote

    favorite












    I am working with a log file that contains entries that appear like this:



    $Hostname1: 0x7FDBF4B1AB10 ( 23698) waiting 100 seconds, NSDThread: for I/O completion on disk vd4
    $Hostname2: 0x7F2D10A2F8C0 ( 25393) waiting 200 seconds, NSDThread: for I/O completion on disk vd35
    $Hostname3: 0x7F2D109F4290 ( 25343) waiting 900 seconds, NSDThread: for I/O completion on disk vd11
    $Hostname4: 0x7FDBF4B1AB30 ( 23698) waiting 100 seconds, NSDThread: for I/O completion on disk vd40
    $Hostname5: 0x7F2D10A2F830 ( 25392) waiting 750 seconds, NSDThread: for I/O completion on disk vd13
    $Hostname6: 0x7F2D109F4240 ( 25342) waiting 500 seconds, NSDThread: for I/O completion on disk vd14


    I would like to filter the lines where the wait time is greater than an arbitrary value (let's say 600 seconds). What's the best way to do this in bash?










    share|improve this question

























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I am working with a log file that contains entries that appear like this:



      $Hostname1: 0x7FDBF4B1AB10 ( 23698) waiting 100 seconds, NSDThread: for I/O completion on disk vd4
      $Hostname2: 0x7F2D10A2F8C0 ( 25393) waiting 200 seconds, NSDThread: for I/O completion on disk vd35
      $Hostname3: 0x7F2D109F4290 ( 25343) waiting 900 seconds, NSDThread: for I/O completion on disk vd11
      $Hostname4: 0x7FDBF4B1AB30 ( 23698) waiting 100 seconds, NSDThread: for I/O completion on disk vd40
      $Hostname5: 0x7F2D10A2F830 ( 25392) waiting 750 seconds, NSDThread: for I/O completion on disk vd13
      $Hostname6: 0x7F2D109F4240 ( 25342) waiting 500 seconds, NSDThread: for I/O completion on disk vd14


      I would like to filter the lines where the wait time is greater than an arbitrary value (let's say 600 seconds). What's the best way to do this in bash?










      share|improve this question















      I am working with a log file that contains entries that appear like this:



      $Hostname1: 0x7FDBF4B1AB10 ( 23698) waiting 100 seconds, NSDThread: for I/O completion on disk vd4
      $Hostname2: 0x7F2D10A2F8C0 ( 25393) waiting 200 seconds, NSDThread: for I/O completion on disk vd35
      $Hostname3: 0x7F2D109F4290 ( 25343) waiting 900 seconds, NSDThread: for I/O completion on disk vd11
      $Hostname4: 0x7FDBF4B1AB30 ( 23698) waiting 100 seconds, NSDThread: for I/O completion on disk vd40
      $Hostname5: 0x7F2D10A2F830 ( 25392) waiting 750 seconds, NSDThread: for I/O completion on disk vd13
      $Hostname6: 0x7F2D109F4240 ( 25342) waiting 500 seconds, NSDThread: for I/O completion on disk vd14


      I would like to filter the lines where the wait time is greater than an arbitrary value (let's say 600 seconds). What's the best way to do this in bash?







      bash






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 43 mins ago









      Goro

      7,48253169




      7,48253169










      asked 46 mins ago









      Kasper

      318112




      318112




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          6
          down vote



          accepted










          This awk will get you want you want.



          awk '$6 > 600 print ' file

          $Hostname3: 0x7F2D109F4290 ( 25343) waiting 900 seconds, NSDThread: for I/O completion on disk vd11
          $Hostname5: 0x7F2D10A2F830 ( 25392) waiting 750 seconds, NSDThread: for I/O completion on disk vd13


          or per @Kusalananda, this linear is enough



          awk '$6 > 600 ' file 





          share|improve this answer






















          • thanking you for help this is what i want
            – Kasper
            40 mins ago







          • 2




            You may drop the print bit if you wish.
            – Kusalananda
            39 mins ago










          • @Kusalananda correct I didn't think about that. Thanks ;-)
            – Goro
            37 mins ago






          • 1




            There's a certain value in keeping print under some circumstances, which is that it's helping to clarify the code. This becomes important when multiple people with varying degrees of awk knowledge needs to understand exactly what's happening. Particularly (not applicable here though), this may be the case when most avid awk-ers may want to use 1 in place of print in a piece of awk code. To a non-initiated, this may be confusing.
            – Kusalananda
            33 mins ago











          • @Kusalananda thanks!
            – Goro
            29 mins ago










          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
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f473974%2fextract-lines-containing-certain-value-or-greater%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          6
          down vote



          accepted










          This awk will get you want you want.



          awk '$6 > 600 print ' file

          $Hostname3: 0x7F2D109F4290 ( 25343) waiting 900 seconds, NSDThread: for I/O completion on disk vd11
          $Hostname5: 0x7F2D10A2F830 ( 25392) waiting 750 seconds, NSDThread: for I/O completion on disk vd13


          or per @Kusalananda, this linear is enough



          awk '$6 > 600 ' file 





          share|improve this answer






















          • thanking you for help this is what i want
            – Kasper
            40 mins ago







          • 2




            You may drop the print bit if you wish.
            – Kusalananda
            39 mins ago










          • @Kusalananda correct I didn't think about that. Thanks ;-)
            – Goro
            37 mins ago






          • 1




            There's a certain value in keeping print under some circumstances, which is that it's helping to clarify the code. This becomes important when multiple people with varying degrees of awk knowledge needs to understand exactly what's happening. Particularly (not applicable here though), this may be the case when most avid awk-ers may want to use 1 in place of print in a piece of awk code. To a non-initiated, this may be confusing.
            – Kusalananda
            33 mins ago











          • @Kusalananda thanks!
            – Goro
            29 mins ago














          up vote
          6
          down vote



          accepted










          This awk will get you want you want.



          awk '$6 > 600 print ' file

          $Hostname3: 0x7F2D109F4290 ( 25343) waiting 900 seconds, NSDThread: for I/O completion on disk vd11
          $Hostname5: 0x7F2D10A2F830 ( 25392) waiting 750 seconds, NSDThread: for I/O completion on disk vd13


          or per @Kusalananda, this linear is enough



          awk '$6 > 600 ' file 





          share|improve this answer






















          • thanking you for help this is what i want
            – Kasper
            40 mins ago







          • 2




            You may drop the print bit if you wish.
            – Kusalananda
            39 mins ago










          • @Kusalananda correct I didn't think about that. Thanks ;-)
            – Goro
            37 mins ago






          • 1




            There's a certain value in keeping print under some circumstances, which is that it's helping to clarify the code. This becomes important when multiple people with varying degrees of awk knowledge needs to understand exactly what's happening. Particularly (not applicable here though), this may be the case when most avid awk-ers may want to use 1 in place of print in a piece of awk code. To a non-initiated, this may be confusing.
            – Kusalananda
            33 mins ago











          • @Kusalananda thanks!
            – Goro
            29 mins ago












          up vote
          6
          down vote



          accepted







          up vote
          6
          down vote



          accepted






          This awk will get you want you want.



          awk '$6 > 600 print ' file

          $Hostname3: 0x7F2D109F4290 ( 25343) waiting 900 seconds, NSDThread: for I/O completion on disk vd11
          $Hostname5: 0x7F2D10A2F830 ( 25392) waiting 750 seconds, NSDThread: for I/O completion on disk vd13


          or per @Kusalananda, this linear is enough



          awk '$6 > 600 ' file 





          share|improve this answer














          This awk will get you want you want.



          awk '$6 > 600 print ' file

          $Hostname3: 0x7F2D109F4290 ( 25343) waiting 900 seconds, NSDThread: for I/O completion on disk vd11
          $Hostname5: 0x7F2D10A2F830 ( 25392) waiting 750 seconds, NSDThread: for I/O completion on disk vd13


          or per @Kusalananda, this linear is enough



          awk '$6 > 600 ' file 






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 37 mins ago

























          answered 44 mins ago









          Goro

          7,48253169




          7,48253169











          • thanking you for help this is what i want
            – Kasper
            40 mins ago







          • 2




            You may drop the print bit if you wish.
            – Kusalananda
            39 mins ago










          • @Kusalananda correct I didn't think about that. Thanks ;-)
            – Goro
            37 mins ago






          • 1




            There's a certain value in keeping print under some circumstances, which is that it's helping to clarify the code. This becomes important when multiple people with varying degrees of awk knowledge needs to understand exactly what's happening. Particularly (not applicable here though), this may be the case when most avid awk-ers may want to use 1 in place of print in a piece of awk code. To a non-initiated, this may be confusing.
            – Kusalananda
            33 mins ago











          • @Kusalananda thanks!
            – Goro
            29 mins ago
















          • thanking you for help this is what i want
            – Kasper
            40 mins ago







          • 2




            You may drop the print bit if you wish.
            – Kusalananda
            39 mins ago










          • @Kusalananda correct I didn't think about that. Thanks ;-)
            – Goro
            37 mins ago






          • 1




            There's a certain value in keeping print under some circumstances, which is that it's helping to clarify the code. This becomes important when multiple people with varying degrees of awk knowledge needs to understand exactly what's happening. Particularly (not applicable here though), this may be the case when most avid awk-ers may want to use 1 in place of print in a piece of awk code. To a non-initiated, this may be confusing.
            – Kusalananda
            33 mins ago











          • @Kusalananda thanks!
            – Goro
            29 mins ago















          thanking you for help this is what i want
          – Kasper
          40 mins ago





          thanking you for help this is what i want
          – Kasper
          40 mins ago





          2




          2




          You may drop the print bit if you wish.
          – Kusalananda
          39 mins ago




          You may drop the print bit if you wish.
          – Kusalananda
          39 mins ago












          @Kusalananda correct I didn't think about that. Thanks ;-)
          – Goro
          37 mins ago




          @Kusalananda correct I didn't think about that. Thanks ;-)
          – Goro
          37 mins ago




          1




          1




          There's a certain value in keeping print under some circumstances, which is that it's helping to clarify the code. This becomes important when multiple people with varying degrees of awk knowledge needs to understand exactly what's happening. Particularly (not applicable here though), this may be the case when most avid awk-ers may want to use 1 in place of print in a piece of awk code. To a non-initiated, this may be confusing.
          – Kusalananda
          33 mins ago





          There's a certain value in keeping print under some circumstances, which is that it's helping to clarify the code. This becomes important when multiple people with varying degrees of awk knowledge needs to understand exactly what's happening. Particularly (not applicable here though), this may be the case when most avid awk-ers may want to use 1 in place of print in a piece of awk code. To a non-initiated, this may be confusing.
          – Kusalananda
          33 mins ago













          @Kusalananda thanks!
          – Goro
          29 mins ago




          @Kusalananda thanks!
          – Goro
          29 mins ago

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f473974%2fextract-lines-containing-certain-value-or-greater%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          What does second last employer means? [closed]

          List of Gilmore Girls characters

          Confectionery