1

I would like to do what is mentioned in How to match case insensitive patterns with ls?

except for ksh. Is it possible to do it without any pain(regex)?

2 Answers2

5

There are 3 main implementations of ksh

  • the original one from David Korn (AT&T ksh), with two main branches: ksh88 and ksh93 (and for ksh93, many version with new features added for each).
  • pdksh, the public domain version (a free reimplementation of ksh88 with which it is mostly compatible) which is the base upon which is built the sh on some BSDs like MirOS or OpenBSD (hence mksh and oksh).
  • The zsh implementation. When called as ksh, zsh emulates the behavior of ksh88 with many of the features of ksh93 as well (and a few differences as well).

With ksh93:

print -r -- *.~(i:txt)

or

print -r -- ~(i)*.txt

With ksh88 or pdksh and its derivatives such as mksh:

print -r -- *.[tT][xX][tT]

With zsh's implementation of ksh:

setopt nocaseglob
print -r -- *.txt

or

setopt extended_glob
print -r -- (#i)*.txt
-2

With out regex, no!

But parsing 'ls' output with grep shouldn't be as much pain (if at all).

ls | grep -i '*xxx*'
Anthon
  • 79,293
Ram
  • 101
  • 1
    Parsing the output of ls is almost always a bad idea. http://mywiki.wooledge.org/ParsingLs – Mat Jan 12 '14 at 11:39