Listing required files

-rwxrwxrwx 1 eurv1adm eurv1 62 Oct  7 07:42 sample.sh
-rwxrwxrwx 1 eurv1adm eurv1  1 Oct 12 08:47 new.sh
-rwxrwxrwx 1 eurv1adm eurv1  0 Oct 12 08:48 MIS322RRF.txt
-rw-r--r-- 1 eurv1adm eurv1  0 Oct 12 09:05 MES8837TETE.txt

I have these files

I want to display files which does not start with "MIS"

-rwxrwxrwx 1 eurv1adm eurv1 62 Oct  7 07:42 sample.sh
-rwxrwxrwx 1 eurv1adm eurv1  1 Oct 12 08:47 new.sh
-rw-r--r-- 1 eurv1adm eurv1  0 Oct 12 09:05 MES8837TETE.txt

What is the command to get the result as required?

That depends on the system and shell you use. With a recent bash ,

shopt -s extglob
ls -la !(MIS*)

might work.

1 Like

Just using standard shell features, you can get what you want with:

ls -l [^M][^I][^S]* M[^I][^S]* [^M]I{^S]* [^M][^I]S* MI[^S]* M[^I]S* [^M]IS* 2>/dev/null

With some shells with some non-standard options and/or environment variables, there are easier ways to do this. For example, with a recent bash shell, you could use:

GLOBIGNORE="MIS*"
ls -l *

And, with a 1993 version of the ksh shell, you could use:

ls -l !(MIS*)

or with a recent bash shell:

shopt -s extglob
ls -l !(MIS*)
1 Like