Menu

Specifying file name patterns

2013-09-05
2013-09-05
  • David Kerber

    David Kerber - 2013-09-05

    I am running into an oddity that makes my searches take much longer than they need to. I am trying to search files named .sas. However, there are other files on the disk names .sas7bdat, which it is also searching, when I don't want it to. How can I exclude the .sas7bdat files when I'm searching .sas files? I've tried adding a trailing space after the .sas, and putting the specification in double-quotes. The trailing space does nothing, and quoting the spec throws a bad file pattern error.

     
  • Jackslade

    Jackslade - 2013-09-05

    Can you also list out or take a screen shot of the search options you have selected. Thanks!

     
  • David Kerber

    David Kerber - 2013-09-05

    AstroGrep ver 4.1.4

    search path: m:\customer\customer1
    file types: *.sas
    search text: metercals

    Options (only ones checked; others are not):
    Search subfolders
    Line Numbers
    Context lines: 0

    If I select "Whole Word", will that apply to the file name as well?

    Thanks for the quick response!
    D

     
  • David Kerber

    David Kerber - 2013-09-05

    I just discovered the "Exclusions" option in the latest ver of AstroGrep, and that is covering me for now. However, I still think that the file types specification entry could use some tightening up. For example .sas shouldn't match .sas7bdat. If I were to enter .sas, then I would expect it to match any extension that started with .sas.

     
  • Jackslade

    Jackslade - 2013-09-05

    Thanks for the replies. I agree with your assumption and will try to find out what is going on.

     
  • Jackslade

    Jackslade - 2013-09-05

    Also, whole word is used against the search text and nothing else.

     
  • David Kerber

    David Kerber - 2013-09-05

    This forum is stripping asterisks and turning them into italics, so the above post looks screwy. What I meant in that last sentence is that if I add a wildcard to the extension .sas, then I would expect it to match .sas7bdat.

     
  • Jackslade

    Jackslade - 2013-09-05

    Hmm, looking at the .Net specification, there is a note about matching using the file filter.

    Here is the note:
    When using the asterisk wildcard character in a searchPattern, such as ".txt", the matching behavior when the extension is exactly three characters long is different than when the extension is more or less than three characters long. A searchPattern with a file extension of exactly three characters returns files having an extension of three or more characters, where the first three characters match the file extension specified in the searchPattern. A searchPattern with a file extension of one, two, or more than three characters returns only files having extensions of exactly that length that match the file extension specified in the searchPattern. When using the question mark wildcard character, this method returns only files that match the specified file extension. For example, given two files, "file1.txt" and "file1.txtother", in a directory, a search pattern of "file?.txt" returns just the first file, while a search pattern of "file.txt" returns both files.

    Seems like when using *.sas it is doing what is specified, but it might not be what you want.

    I'll create a request to look into this more.

     
  • David Kerber

    David Kerber - 2013-09-05

    I agree that it does appear to be working as specified. I just don't understand why the specification would be written this way. This is also how it works at the Win7 command line. Funky spec, IMO.

     
  • Jackslade

    Jackslade - 2013-09-05

    I created bug ticket #45 for this issue.

     

Log in to post a comment.

MongoDB Logo MongoDB