How to grep files by regexp and number of lines











up vote
0
down vote

favorite












I need to grep only files that does not contain use Test::More tests => 1; string and having more than 10 strings. How to do that ?



Typical solution for printing file names without match is using grep -L flag and typical solution for counting line numbers is using wc -l. But how to combine them ?



grep -rL "use Test::More tests => 1;" t | wc -l


is showing just number of results in grep output.










share|improve this question






















  • By "having more than 10 strings", do you mean more than ten lines? If not, can you clarify? Do you mean more than ten lines of distinct code?
    – Paul Hodges
    Nov 20 at 15:15

















up vote
0
down vote

favorite












I need to grep only files that does not contain use Test::More tests => 1; string and having more than 10 strings. How to do that ?



Typical solution for printing file names without match is using grep -L flag and typical solution for counting line numbers is using wc -l. But how to combine them ?



grep -rL "use Test::More tests => 1;" t | wc -l


is showing just number of results in grep output.










share|improve this question






















  • By "having more than 10 strings", do you mean more than ten lines? If not, can you clarify? Do you mean more than ten lines of distinct code?
    – Paul Hodges
    Nov 20 at 15:15















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I need to grep only files that does not contain use Test::More tests => 1; string and having more than 10 strings. How to do that ?



Typical solution for printing file names without match is using grep -L flag and typical solution for counting line numbers is using wc -l. But how to combine them ?



grep -rL "use Test::More tests => 1;" t | wc -l


is showing just number of results in grep output.










share|improve this question













I need to grep only files that does not contain use Test::More tests => 1; string and having more than 10 strings. How to do that ?



Typical solution for printing file names without match is using grep -L flag and typical solution for counting line numbers is using wc -l. But how to combine them ?



grep -rL "use Test::More tests => 1;" t | wc -l


is showing just number of results in grep output.







bash






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 20 at 14:34









Paul Serikov

326115




326115












  • By "having more than 10 strings", do you mean more than ten lines? If not, can you clarify? Do you mean more than ten lines of distinct code?
    – Paul Hodges
    Nov 20 at 15:15




















  • By "having more than 10 strings", do you mean more than ten lines? If not, can you clarify? Do you mean more than ten lines of distinct code?
    – Paul Hodges
    Nov 20 at 15:15


















By "having more than 10 strings", do you mean more than ten lines? If not, can you clarify? Do you mean more than ten lines of distinct code?
– Paul Hodges
Nov 20 at 15:15






By "having more than 10 strings", do you mean more than ten lines? If not, can you clarify? Do you mean more than ten lines of distinct code?
– Paul Hodges
Nov 20 at 15:15














3 Answers
3






active

oldest

votes

















up vote
1
down vote













grep -L will list files that do not contain the search string. So, grep -L is a fundamental part of your solution. However, by piping the result to wc -l, you are simply counting all the files that do not contain the search string. This is not what you wanted as you indicated. Rather, you just want to list files that don't have the search string AND have more than 10 lines. Consider the following code:



grep -rL "use Test::More tests => 1;" t  | xargs wc -l | awk '$1 > 10 {print $2}' 


The most interesting command here is xargs which takes the output coming in on stdin and passes that as arguments to the next command: wc -l. Now wc -l will give you a list of linecounts and the file name. This gets piped to awk that selects all lines that have the first column value greater than 10 and displays only the second column.



You might find it useful to run the commands separately to see the output passed to the next pipe:



grep -rL "use Test::More tests => 1;" t  | xargs echo

grep -rL "use Test::More tests => 1;" t | xargs wc -l

grep -rL "use Test::More tests => 1;" t | xargs wc -l | awk '$1 > 10 '


And then putting it all together:



grep -rL "use Test::More tests => 1;" t  | xargs wc -l | awk '$1 > 10 {print $2}'





share|improve this answer




























    up vote
    1
    down vote













    You can run a loop using find in process substitution:



    while IFS= read -d '' -r file; do
    grep -Fq 'use Test::More tests => 1;' "$file" &&
    (( $(wc -l < "$file") >= 10 )) && echo "$file"
    done < <(find . -type f -print0)


    This code takes care of filenames with space, newlines or glob characters.






    share|improve this answer




























      up vote
      0
      down vote













      TL;DR:



      awk 'FNR==1 { found=0 }
      /uses+Test::Mores+testss*=>s*1s*;/ { found=1; }
      FNR > 10 { if ( found ) { print FILENAME; nextfile } }' t/*





      Breaking it down, with and without grep.




      To only get files with more than 10 lines:



      awk 'FNR==11 { print FILENAME; nextfile; }' *


      FNR is "File Number of Record", i.e., which line of this file are we on. If it's 11, there are more than ten lines, so print the FILENAME and move on the the next file.



      You can save a list of files without your search string to an array with



      declare -a lst=( $( grep -rL "use Test::More tests => 1;" t ) )


      Then you can report those with over ten lines with



      awk 'FNR==11 { print FILENAME; nextfile; }' "${lst[@]}"


      Though I'd recommend not being quite so rigid - sometimes people fumble-finger or align things, etc, so try it this way:



      declare -a lst=( $( grep -rLE "uses+Test::Mores+testss*=>s*1s*;" t ) )
      awk 'FNR==11 { print FILENAME; nextfile; }' "${lst[@]}"


      You could do it all in one line with a subcall, like so:



      awk 'FNR==11 { print FILENAME; nextfile; }' $( grep -rLE "uses+Test::Mores+testss*=>s*1s*;" t )


      This also avoids unnecessary extraneous executions. If you want to really trim it down, we could likely do it all in one awk, but if we need to traverse more than the one subdirectory then we ought to use grep or find anyway. Otherwise,




      if you are only searching the files in the t directory and not its children -




      awk 'FNR==1 { found=0 }
      /uses+Test::Mores+testss*=>s*1s*;/ { found=1; }
      FNR > 10 { if ( found ) { print FILENAME; nextfile } }' t/*


      You could refine this is, for example, all the files you are checking have a name like *.pl, which would avoid trying to read directories and other such ugliness. Likewise, this may get confused by odd/off filenames.




      But IF what you actually wanted was files with more than ten distinct lines that do NOT have your token string in them, then change the awk to -




      awk '1 == FNR { cnt=0; found=0; }
      hit[$0] { next; }
      /uses+Test::Mores+testss*=>s*1s*;/ { found=1; }
      { hit[$0]=1; cnt++;
      if ( 10 < cnt ) { print FILENAME; nextfile; }
      }
      ' t/*


      Yes, you can squish all that into one line if you prefer but ew, don't, lol.






      share|improve this answer























        Your Answer






        StackExchange.ifUsing("editor", function () {
        StackExchange.using("externalEditor", function () {
        StackExchange.using("snippets", function () {
        StackExchange.snippets.init();
        });
        });
        }, "code-snippets");

        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "1"
        };
        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: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53395328%2fhow-to-grep-files-by-regexp-and-number-of-lines%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes








        up vote
        1
        down vote













        grep -L will list files that do not contain the search string. So, grep -L is a fundamental part of your solution. However, by piping the result to wc -l, you are simply counting all the files that do not contain the search string. This is not what you wanted as you indicated. Rather, you just want to list files that don't have the search string AND have more than 10 lines. Consider the following code:



        grep -rL "use Test::More tests => 1;" t  | xargs wc -l | awk '$1 > 10 {print $2}' 


        The most interesting command here is xargs which takes the output coming in on stdin and passes that as arguments to the next command: wc -l. Now wc -l will give you a list of linecounts and the file name. This gets piped to awk that selects all lines that have the first column value greater than 10 and displays only the second column.



        You might find it useful to run the commands separately to see the output passed to the next pipe:



        grep -rL "use Test::More tests => 1;" t  | xargs echo

        grep -rL "use Test::More tests => 1;" t | xargs wc -l

        grep -rL "use Test::More tests => 1;" t | xargs wc -l | awk '$1 > 10 '


        And then putting it all together:



        grep -rL "use Test::More tests => 1;" t  | xargs wc -l | awk '$1 > 10 {print $2}'





        share|improve this answer

























          up vote
          1
          down vote













          grep -L will list files that do not contain the search string. So, grep -L is a fundamental part of your solution. However, by piping the result to wc -l, you are simply counting all the files that do not contain the search string. This is not what you wanted as you indicated. Rather, you just want to list files that don't have the search string AND have more than 10 lines. Consider the following code:



          grep -rL "use Test::More tests => 1;" t  | xargs wc -l | awk '$1 > 10 {print $2}' 


          The most interesting command here is xargs which takes the output coming in on stdin and passes that as arguments to the next command: wc -l. Now wc -l will give you a list of linecounts and the file name. This gets piped to awk that selects all lines that have the first column value greater than 10 and displays only the second column.



          You might find it useful to run the commands separately to see the output passed to the next pipe:



          grep -rL "use Test::More tests => 1;" t  | xargs echo

          grep -rL "use Test::More tests => 1;" t | xargs wc -l

          grep -rL "use Test::More tests => 1;" t | xargs wc -l | awk '$1 > 10 '


          And then putting it all together:



          grep -rL "use Test::More tests => 1;" t  | xargs wc -l | awk '$1 > 10 {print $2}'





          share|improve this answer























            up vote
            1
            down vote










            up vote
            1
            down vote









            grep -L will list files that do not contain the search string. So, grep -L is a fundamental part of your solution. However, by piping the result to wc -l, you are simply counting all the files that do not contain the search string. This is not what you wanted as you indicated. Rather, you just want to list files that don't have the search string AND have more than 10 lines. Consider the following code:



            grep -rL "use Test::More tests => 1;" t  | xargs wc -l | awk '$1 > 10 {print $2}' 


            The most interesting command here is xargs which takes the output coming in on stdin and passes that as arguments to the next command: wc -l. Now wc -l will give you a list of linecounts and the file name. This gets piped to awk that selects all lines that have the first column value greater than 10 and displays only the second column.



            You might find it useful to run the commands separately to see the output passed to the next pipe:



            grep -rL "use Test::More tests => 1;" t  | xargs echo

            grep -rL "use Test::More tests => 1;" t | xargs wc -l

            grep -rL "use Test::More tests => 1;" t | xargs wc -l | awk '$1 > 10 '


            And then putting it all together:



            grep -rL "use Test::More tests => 1;" t  | xargs wc -l | awk '$1 > 10 {print $2}'





            share|improve this answer












            grep -L will list files that do not contain the search string. So, grep -L is a fundamental part of your solution. However, by piping the result to wc -l, you are simply counting all the files that do not contain the search string. This is not what you wanted as you indicated. Rather, you just want to list files that don't have the search string AND have more than 10 lines. Consider the following code:



            grep -rL "use Test::More tests => 1;" t  | xargs wc -l | awk '$1 > 10 {print $2}' 


            The most interesting command here is xargs which takes the output coming in on stdin and passes that as arguments to the next command: wc -l. Now wc -l will give you a list of linecounts and the file name. This gets piped to awk that selects all lines that have the first column value greater than 10 and displays only the second column.



            You might find it useful to run the commands separately to see the output passed to the next pipe:



            grep -rL "use Test::More tests => 1;" t  | xargs echo

            grep -rL "use Test::More tests => 1;" t | xargs wc -l

            grep -rL "use Test::More tests => 1;" t | xargs wc -l | awk '$1 > 10 '


            And then putting it all together:



            grep -rL "use Test::More tests => 1;" t  | xargs wc -l | awk '$1 > 10 {print $2}'






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 20 at 14:45









            Mark

            69249




            69249
























                up vote
                1
                down vote













                You can run a loop using find in process substitution:



                while IFS= read -d '' -r file; do
                grep -Fq 'use Test::More tests => 1;' "$file" &&
                (( $(wc -l < "$file") >= 10 )) && echo "$file"
                done < <(find . -type f -print0)


                This code takes care of filenames with space, newlines or glob characters.






                share|improve this answer

























                  up vote
                  1
                  down vote













                  You can run a loop using find in process substitution:



                  while IFS= read -d '' -r file; do
                  grep -Fq 'use Test::More tests => 1;' "$file" &&
                  (( $(wc -l < "$file") >= 10 )) && echo "$file"
                  done < <(find . -type f -print0)


                  This code takes care of filenames with space, newlines or glob characters.






                  share|improve this answer























                    up vote
                    1
                    down vote










                    up vote
                    1
                    down vote









                    You can run a loop using find in process substitution:



                    while IFS= read -d '' -r file; do
                    grep -Fq 'use Test::More tests => 1;' "$file" &&
                    (( $(wc -l < "$file") >= 10 )) && echo "$file"
                    done < <(find . -type f -print0)


                    This code takes care of filenames with space, newlines or glob characters.






                    share|improve this answer












                    You can run a loop using find in process substitution:



                    while IFS= read -d '' -r file; do
                    grep -Fq 'use Test::More tests => 1;' "$file" &&
                    (( $(wc -l < "$file") >= 10 )) && echo "$file"
                    done < <(find . -type f -print0)


                    This code takes care of filenames with space, newlines or glob characters.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 20 at 14:48









                    anubhava

                    518k46311387




                    518k46311387






















                        up vote
                        0
                        down vote













                        TL;DR:



                        awk 'FNR==1 { found=0 }
                        /uses+Test::Mores+testss*=>s*1s*;/ { found=1; }
                        FNR > 10 { if ( found ) { print FILENAME; nextfile } }' t/*





                        Breaking it down, with and without grep.




                        To only get files with more than 10 lines:



                        awk 'FNR==11 { print FILENAME; nextfile; }' *


                        FNR is "File Number of Record", i.e., which line of this file are we on. If it's 11, there are more than ten lines, so print the FILENAME and move on the the next file.



                        You can save a list of files without your search string to an array with



                        declare -a lst=( $( grep -rL "use Test::More tests => 1;" t ) )


                        Then you can report those with over ten lines with



                        awk 'FNR==11 { print FILENAME; nextfile; }' "${lst[@]}"


                        Though I'd recommend not being quite so rigid - sometimes people fumble-finger or align things, etc, so try it this way:



                        declare -a lst=( $( grep -rLE "uses+Test::Mores+testss*=>s*1s*;" t ) )
                        awk 'FNR==11 { print FILENAME; nextfile; }' "${lst[@]}"


                        You could do it all in one line with a subcall, like so:



                        awk 'FNR==11 { print FILENAME; nextfile; }' $( grep -rLE "uses+Test::Mores+testss*=>s*1s*;" t )


                        This also avoids unnecessary extraneous executions. If you want to really trim it down, we could likely do it all in one awk, but if we need to traverse more than the one subdirectory then we ought to use grep or find anyway. Otherwise,




                        if you are only searching the files in the t directory and not its children -




                        awk 'FNR==1 { found=0 }
                        /uses+Test::Mores+testss*=>s*1s*;/ { found=1; }
                        FNR > 10 { if ( found ) { print FILENAME; nextfile } }' t/*


                        You could refine this is, for example, all the files you are checking have a name like *.pl, which would avoid trying to read directories and other such ugliness. Likewise, this may get confused by odd/off filenames.




                        But IF what you actually wanted was files with more than ten distinct lines that do NOT have your token string in them, then change the awk to -




                        awk '1 == FNR { cnt=0; found=0; }
                        hit[$0] { next; }
                        /uses+Test::Mores+testss*=>s*1s*;/ { found=1; }
                        { hit[$0]=1; cnt++;
                        if ( 10 < cnt ) { print FILENAME; nextfile; }
                        }
                        ' t/*


                        Yes, you can squish all that into one line if you prefer but ew, don't, lol.






                        share|improve this answer



























                          up vote
                          0
                          down vote













                          TL;DR:



                          awk 'FNR==1 { found=0 }
                          /uses+Test::Mores+testss*=>s*1s*;/ { found=1; }
                          FNR > 10 { if ( found ) { print FILENAME; nextfile } }' t/*





                          Breaking it down, with and without grep.




                          To only get files with more than 10 lines:



                          awk 'FNR==11 { print FILENAME; nextfile; }' *


                          FNR is "File Number of Record", i.e., which line of this file are we on. If it's 11, there are more than ten lines, so print the FILENAME and move on the the next file.



                          You can save a list of files without your search string to an array with



                          declare -a lst=( $( grep -rL "use Test::More tests => 1;" t ) )


                          Then you can report those with over ten lines with



                          awk 'FNR==11 { print FILENAME; nextfile; }' "${lst[@]}"


                          Though I'd recommend not being quite so rigid - sometimes people fumble-finger or align things, etc, so try it this way:



                          declare -a lst=( $( grep -rLE "uses+Test::Mores+testss*=>s*1s*;" t ) )
                          awk 'FNR==11 { print FILENAME; nextfile; }' "${lst[@]}"


                          You could do it all in one line with a subcall, like so:



                          awk 'FNR==11 { print FILENAME; nextfile; }' $( grep -rLE "uses+Test::Mores+testss*=>s*1s*;" t )


                          This also avoids unnecessary extraneous executions. If you want to really trim it down, we could likely do it all in one awk, but if we need to traverse more than the one subdirectory then we ought to use grep or find anyway. Otherwise,




                          if you are only searching the files in the t directory and not its children -




                          awk 'FNR==1 { found=0 }
                          /uses+Test::Mores+testss*=>s*1s*;/ { found=1; }
                          FNR > 10 { if ( found ) { print FILENAME; nextfile } }' t/*


                          You could refine this is, for example, all the files you are checking have a name like *.pl, which would avoid trying to read directories and other such ugliness. Likewise, this may get confused by odd/off filenames.




                          But IF what you actually wanted was files with more than ten distinct lines that do NOT have your token string in them, then change the awk to -




                          awk '1 == FNR { cnt=0; found=0; }
                          hit[$0] { next; }
                          /uses+Test::Mores+testss*=>s*1s*;/ { found=1; }
                          { hit[$0]=1; cnt++;
                          if ( 10 < cnt ) { print FILENAME; nextfile; }
                          }
                          ' t/*


                          Yes, you can squish all that into one line if you prefer but ew, don't, lol.






                          share|improve this answer

























                            up vote
                            0
                            down vote










                            up vote
                            0
                            down vote









                            TL;DR:



                            awk 'FNR==1 { found=0 }
                            /uses+Test::Mores+testss*=>s*1s*;/ { found=1; }
                            FNR > 10 { if ( found ) { print FILENAME; nextfile } }' t/*





                            Breaking it down, with and without grep.




                            To only get files with more than 10 lines:



                            awk 'FNR==11 { print FILENAME; nextfile; }' *


                            FNR is "File Number of Record", i.e., which line of this file are we on. If it's 11, there are more than ten lines, so print the FILENAME and move on the the next file.



                            You can save a list of files without your search string to an array with



                            declare -a lst=( $( grep -rL "use Test::More tests => 1;" t ) )


                            Then you can report those with over ten lines with



                            awk 'FNR==11 { print FILENAME; nextfile; }' "${lst[@]}"


                            Though I'd recommend not being quite so rigid - sometimes people fumble-finger or align things, etc, so try it this way:



                            declare -a lst=( $( grep -rLE "uses+Test::Mores+testss*=>s*1s*;" t ) )
                            awk 'FNR==11 { print FILENAME; nextfile; }' "${lst[@]}"


                            You could do it all in one line with a subcall, like so:



                            awk 'FNR==11 { print FILENAME; nextfile; }' $( grep -rLE "uses+Test::Mores+testss*=>s*1s*;" t )


                            This also avoids unnecessary extraneous executions. If you want to really trim it down, we could likely do it all in one awk, but if we need to traverse more than the one subdirectory then we ought to use grep or find anyway. Otherwise,




                            if you are only searching the files in the t directory and not its children -




                            awk 'FNR==1 { found=0 }
                            /uses+Test::Mores+testss*=>s*1s*;/ { found=1; }
                            FNR > 10 { if ( found ) { print FILENAME; nextfile } }' t/*


                            You could refine this is, for example, all the files you are checking have a name like *.pl, which would avoid trying to read directories and other such ugliness. Likewise, this may get confused by odd/off filenames.




                            But IF what you actually wanted was files with more than ten distinct lines that do NOT have your token string in them, then change the awk to -




                            awk '1 == FNR { cnt=0; found=0; }
                            hit[$0] { next; }
                            /uses+Test::Mores+testss*=>s*1s*;/ { found=1; }
                            { hit[$0]=1; cnt++;
                            if ( 10 < cnt ) { print FILENAME; nextfile; }
                            }
                            ' t/*


                            Yes, you can squish all that into one line if you prefer but ew, don't, lol.






                            share|improve this answer














                            TL;DR:



                            awk 'FNR==1 { found=0 }
                            /uses+Test::Mores+testss*=>s*1s*;/ { found=1; }
                            FNR > 10 { if ( found ) { print FILENAME; nextfile } }' t/*





                            Breaking it down, with and without grep.




                            To only get files with more than 10 lines:



                            awk 'FNR==11 { print FILENAME; nextfile; }' *


                            FNR is "File Number of Record", i.e., which line of this file are we on. If it's 11, there are more than ten lines, so print the FILENAME and move on the the next file.



                            You can save a list of files without your search string to an array with



                            declare -a lst=( $( grep -rL "use Test::More tests => 1;" t ) )


                            Then you can report those with over ten lines with



                            awk 'FNR==11 { print FILENAME; nextfile; }' "${lst[@]}"


                            Though I'd recommend not being quite so rigid - sometimes people fumble-finger or align things, etc, so try it this way:



                            declare -a lst=( $( grep -rLE "uses+Test::Mores+testss*=>s*1s*;" t ) )
                            awk 'FNR==11 { print FILENAME; nextfile; }' "${lst[@]}"


                            You could do it all in one line with a subcall, like so:



                            awk 'FNR==11 { print FILENAME; nextfile; }' $( grep -rLE "uses+Test::Mores+testss*=>s*1s*;" t )


                            This also avoids unnecessary extraneous executions. If you want to really trim it down, we could likely do it all in one awk, but if we need to traverse more than the one subdirectory then we ought to use grep or find anyway. Otherwise,




                            if you are only searching the files in the t directory and not its children -




                            awk 'FNR==1 { found=0 }
                            /uses+Test::Mores+testss*=>s*1s*;/ { found=1; }
                            FNR > 10 { if ( found ) { print FILENAME; nextfile } }' t/*


                            You could refine this is, for example, all the files you are checking have a name like *.pl, which would avoid trying to read directories and other such ugliness. Likewise, this may get confused by odd/off filenames.




                            But IF what you actually wanted was files with more than ten distinct lines that do NOT have your token string in them, then change the awk to -




                            awk '1 == FNR { cnt=0; found=0; }
                            hit[$0] { next; }
                            /uses+Test::Mores+testss*=>s*1s*;/ { found=1; }
                            { hit[$0]=1; cnt++;
                            if ( 10 < cnt ) { print FILENAME; nextfile; }
                            }
                            ' t/*


                            Yes, you can squish all that into one line if you prefer but ew, don't, lol.







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Nov 20 at 16:43

























                            answered Nov 20 at 15:14









                            Paul Hodges

                            2,6071320




                            2,6071320






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.





                                Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                Please pay close attention to the following guidance:


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53395328%2fhow-to-grep-files-by-regexp-and-number-of-lines%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                404 Error Contact Form 7 ajax form submitting

                                How to know if a Active Directory user can login interactively

                                TypeError: fit_transform() missing 1 required positional argument: 'X'