How to select rows in a given range?

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











up vote
2
down vote

favorite












I have a file with 2 columns:



head positions_vcf
4 68264840
4 52784678
4 52788987
4 52795404
4 52800097
4 52801203
4 52804052
4 52804766
4 52804941
4 52805425
4 52807245
4 52809203
4 52809705
4 52810211
4 52810307
4 52811970
4 52812994
4 52814042
4 52814185
4 52815272


I need to select only rows in which the second column is within the range of "52804760-52809700".
my desired out_put



desired_output
4 52804766
4 52804941
4 52805425
4 52807245
4 52809203






share|improve this question























    up vote
    2
    down vote

    favorite












    I have a file with 2 columns:



    head positions_vcf
    4 68264840
    4 52784678
    4 52788987
    4 52795404
    4 52800097
    4 52801203
    4 52804052
    4 52804766
    4 52804941
    4 52805425
    4 52807245
    4 52809203
    4 52809705
    4 52810211
    4 52810307
    4 52811970
    4 52812994
    4 52814042
    4 52814185
    4 52815272


    I need to select only rows in which the second column is within the range of "52804760-52809700".
    my desired out_put



    desired_output
    4 52804766
    4 52804941
    4 52805425
    4 52807245
    4 52809203






    share|improve this question





















      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      I have a file with 2 columns:



      head positions_vcf
      4 68264840
      4 52784678
      4 52788987
      4 52795404
      4 52800097
      4 52801203
      4 52804052
      4 52804766
      4 52804941
      4 52805425
      4 52807245
      4 52809203
      4 52809705
      4 52810211
      4 52810307
      4 52811970
      4 52812994
      4 52814042
      4 52814185
      4 52815272


      I need to select only rows in which the second column is within the range of "52804760-52809700".
      my desired out_put



      desired_output
      4 52804766
      4 52804941
      4 52805425
      4 52807245
      4 52809203






      share|improve this question











      I have a file with 2 columns:



      head positions_vcf
      4 68264840
      4 52784678
      4 52788987
      4 52795404
      4 52800097
      4 52801203
      4 52804052
      4 52804766
      4 52804941
      4 52805425
      4 52807245
      4 52809203
      4 52809705
      4 52810211
      4 52810307
      4 52811970
      4 52812994
      4 52814042
      4 52814185
      4 52815272


      I need to select only rows in which the second column is within the range of "52804760-52809700".
      my desired out_put



      desired_output
      4 52804766
      4 52804941
      4 52805425
      4 52807245
      4 52809203








      share|improve this question










      share|improve this question




      share|improve this question









      asked May 3 at 17:11









      Anna1364

      421110




      421110




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          Using awk:



          awk '$2 >= 52804760 && $2 <= 52809700' positions_vcf





          share|improve this answer



















          • 2




            or more awk-ishly: awk '$2 >= 52804760 && $2 <= 52809700'
            – Jeff Schaller
            May 3 at 17:16






          • 1




            For readability, I like to use this style: 52804760 <= $2 && $2 <= 52809700
            – glenn jackman
            May 3 at 17:19










          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%2f441606%2fhow-to-select-rows-in-a-given-range%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
          3
          down vote



          accepted










          Using awk:



          awk '$2 >= 52804760 && $2 <= 52809700' positions_vcf





          share|improve this answer



















          • 2




            or more awk-ishly: awk '$2 >= 52804760 && $2 <= 52809700'
            – Jeff Schaller
            May 3 at 17:16






          • 1




            For readability, I like to use this style: 52804760 <= $2 && $2 <= 52809700
            – glenn jackman
            May 3 at 17:19














          up vote
          3
          down vote



          accepted










          Using awk:



          awk '$2 >= 52804760 && $2 <= 52809700' positions_vcf





          share|improve this answer



















          • 2




            or more awk-ishly: awk '$2 >= 52804760 && $2 <= 52809700'
            – Jeff Schaller
            May 3 at 17:16






          • 1




            For readability, I like to use this style: 52804760 <= $2 && $2 <= 52809700
            – glenn jackman
            May 3 at 17:19












          up vote
          3
          down vote



          accepted







          up vote
          3
          down vote



          accepted






          Using awk:



          awk '$2 >= 52804760 && $2 <= 52809700' positions_vcf





          share|improve this answer















          Using awk:



          awk '$2 >= 52804760 && $2 <= 52809700' positions_vcf






          share|improve this answer















          share|improve this answer



          share|improve this answer








          edited May 3 at 17:17


























          answered May 3 at 17:15









          Jesse_b

          10.3k22658




          10.3k22658







          • 2




            or more awk-ishly: awk '$2 >= 52804760 && $2 <= 52809700'
            – Jeff Schaller
            May 3 at 17:16






          • 1




            For readability, I like to use this style: 52804760 <= $2 && $2 <= 52809700
            – glenn jackman
            May 3 at 17:19












          • 2




            or more awk-ishly: awk '$2 >= 52804760 && $2 <= 52809700'
            – Jeff Schaller
            May 3 at 17:16






          • 1




            For readability, I like to use this style: 52804760 <= $2 && $2 <= 52809700
            – glenn jackman
            May 3 at 17:19







          2




          2




          or more awk-ishly: awk '$2 >= 52804760 && $2 <= 52809700'
          – Jeff Schaller
          May 3 at 17:16




          or more awk-ishly: awk '$2 >= 52804760 && $2 <= 52809700'
          – Jeff Schaller
          May 3 at 17:16




          1




          1




          For readability, I like to use this style: 52804760 <= $2 && $2 <= 52809700
          – glenn jackman
          May 3 at 17:19




          For readability, I like to use this style: 52804760 <= $2 && $2 <= 52809700
          – glenn jackman
          May 3 at 17:19












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f441606%2fhow-to-select-rows-in-a-given-range%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay