ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Qshell FIND command case-sensitivity

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Qshell FIND command case-sensitivity

    Hi Folks

    This is an odd one. I can't find (no pun intended) anywhere, not even in the qshell manual, whether the 'expression' (what you're searching for) in FIND is case-sensitive or not.

    A quick test with -name suggests that it is case-sensitive. Is there a way to specify that it not be?

    It would seem that Unix bods have an -iname flag that Qshell lacks (and qp2term for that matter).

    I'm sure there are many work-arounds (grep, etc.) but my question is specifically about FIND.

    Thanks.


  • #2
    Seems like you've already answered your own question, here.

    Comment


    • #3
      Let me state the question more clearly then:

      How do I make the Qshell FIND command case-insensitive?

      Comment


      • #4
        You can't, aside from downloading a different FIND utility that's got the -iname option that you mentioned.

        Instead, I would suggest writing an expression that will match both upper and lower case filenames where necessary, since you can't make it case insensitive. Or use something like grep (which you already said I'm not allowed to suggest.)

        Comment


        • #5
          Wasn't sure if my 2nd point (using an expression that matches both upper/lowercase) was clear, so I thought I'd provide an example. Let's say you want to find all files that end in .pdf, but you want to match both upper and lowercase letters (.pdf, .PDF, .PdF. .pDf. etc) then you could do this:

          Code:
          find /mydir -name '*.[Pp][Dd][Ff]'
          The square brackets mean "matches anything in the list". So when I say [Pp] that means this character can be either P or p. Then [Dd] which means either D or d, etc. So *.[Pp][Dd][Ff] means anything ending with a dot, followed by the letters P,D and F in either upper or lowercase.

          Comment

          Working...
          X