Rich’s pattern doesn’t work for me, but this does:

```
\A([^\r]*\r){N}\z
```

Details:

```
                   match:
\A                  - the beginning of the file
  (        ){N}     - followed by exactly N of:
   [^\r]*              - zero or more non-linebreak characters
         \r            - followed by a linebreak
               \z   - followed by the end of the file
```

Note that this assumes that all files end in a linebreak. If they might not, you need a slightly more complicated expression:

```
\A([^\r]*\r){M}[^\r]+\Z
```

Where `M` is one _less_ than your target number of lines.

Details:

```
                         match:
\A                        - the beginning of the file
  (        ){M}           - followed by exactly M of:
   [^\r]*                    - zero or more non-linebreak characters
         \r                  - followed by a linebreak
[^\r]+ - followed by one or more non-linebreak characters \Z - followed by the end of the file OR a trailing newline
```

That was fun. Thanks, all. :)
-sam

On 11 Dec 2018, at 10:45, Rich Siegel wrote:

On 12/10/18 at 7:26 AM, [email protected] (Philippe Carly) wrote:

More specifically, I have a directory which contains a large number of subdirectories, each containing (among other things) a fileinfo.php file. I now that this fileinfo.php should have N lines. And I am trying to locate files that have more or less than N lines to search for potential problems.

If I am understand your description correctly, something like this should work:

-   search for:

    ^.*?\n{XXX} -- replace the "XXX" with the desired number of lines

-   turn on "Exclude Matches"

-   run your multi-file search.

This will return all files that don't have XXX lines in them.

You can add a file filter to only search "fileinfo.php" files to further narrow things down.

R.
--
Rich Siegel                                 Bare Bones Software, Inc.
<[email protected]> <http://www.barebones.com/>

Someday I'll look back on all this and laugh... until they sedate me.

--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <https://www.twitter.com/bbedit>
--- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/bbedit.

--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <https://www.twitter.com/bbedit>
--- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/bbedit.

Reply via email to