Find all the filenames in this directory that do not contain 'a' 'b' or 'c' in their name [duplicate]
Clash Royale CLAN TAG#URR8PPP
up vote
-2
down vote
favorite
This question already has an answer here:
Why does `ls -d *[!e]*` display all files instead of omitting all files that contain an e?
1 answer
I am trying to find all the files in my directory that does not contain the letters a,b or c; why does this command not work?
ls *[!abc]*
example: eg: MATCH: xyz, dkh, file, foo; NOT MATCH: bar, bxc, azi,csk
linux bash command-line filenames
marked as duplicate by Goro, Thomas, Romeo Ninov, agc, RalfFriedl Sep 23 at 11:59
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
up vote
-2
down vote
favorite
This question already has an answer here:
Why does `ls -d *[!e]*` display all files instead of omitting all files that contain an e?
1 answer
I am trying to find all the files in my directory that does not contain the letters a,b or c; why does this command not work?
ls *[!abc]*
example: eg: MATCH: xyz, dkh, file, foo; NOT MATCH: bar, bxc, azi,csk
linux bash command-line filenames
marked as duplicate by Goro, Thomas, Romeo Ninov, agc, RalfFriedl Sep 23 at 11:59
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Would you please add more description. In addition, example and the expected output.
â Goro
Sep 22 at 19:15
add a comment |Â
up vote
-2
down vote
favorite
up vote
-2
down vote
favorite
This question already has an answer here:
Why does `ls -d *[!e]*` display all files instead of omitting all files that contain an e?
1 answer
I am trying to find all the files in my directory that does not contain the letters a,b or c; why does this command not work?
ls *[!abc]*
example: eg: MATCH: xyz, dkh, file, foo; NOT MATCH: bar, bxc, azi,csk
linux bash command-line filenames
This question already has an answer here:
Why does `ls -d *[!e]*` display all files instead of omitting all files that contain an e?
1 answer
I am trying to find all the files in my directory that does not contain the letters a,b or c; why does this command not work?
ls *[!abc]*
example: eg: MATCH: xyz, dkh, file, foo; NOT MATCH: bar, bxc, azi,csk
This question already has an answer here:
Why does `ls -d *[!e]*` display all files instead of omitting all files that contain an e?
1 answer
linux bash command-line filenames
linux bash command-line filenames
edited Sep 22 at 19:25
asked Sep 22 at 18:59
amendeep singh
112
112
marked as duplicate by Goro, Thomas, Romeo Ninov, agc, RalfFriedl Sep 23 at 11:59
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Goro, Thomas, Romeo Ninov, agc, RalfFriedl Sep 23 at 11:59
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Would you please add more description. In addition, example and the expected output.
â Goro
Sep 22 at 19:15
add a comment |Â
Would you please add more description. In addition, example and the expected output.
â Goro
Sep 22 at 19:15
Would you please add more description. In addition, example and the expected output.
â Goro
Sep 22 at 19:15
Would you please add more description. In addition, example and the expected output.
â Goro
Sep 22 at 19:15
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
Your command does something very similar to what you want: it expands to the list of filenames that are not exactly: a
, b
, or c
. If you test, you see:
$ touch a b c d
$ ls *[!abc]*
d
But if you create another file and re-test:
$ touch argh
$ ls *[!abc]*
argh d
To exclude file names that contain those characters anywhere, use:
$ shopt -s extglob
$ ls !(*[abc]*)
d
Another way of doing it (again with extended globs) would be to explicitly list out the patterns:
$ ls !(*a*|*b*|*c*)
d
thanks thats exactly what i needed
â amendeep singh
Sep 22 at 19:32
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
Your command does something very similar to what you want: it expands to the list of filenames that are not exactly: a
, b
, or c
. If you test, you see:
$ touch a b c d
$ ls *[!abc]*
d
But if you create another file and re-test:
$ touch argh
$ ls *[!abc]*
argh d
To exclude file names that contain those characters anywhere, use:
$ shopt -s extglob
$ ls !(*[abc]*)
d
Another way of doing it (again with extended globs) would be to explicitly list out the patterns:
$ ls !(*a*|*b*|*c*)
d
thanks thats exactly what i needed
â amendeep singh
Sep 22 at 19:32
add a comment |Â
up vote
0
down vote
accepted
Your command does something very similar to what you want: it expands to the list of filenames that are not exactly: a
, b
, or c
. If you test, you see:
$ touch a b c d
$ ls *[!abc]*
d
But if you create another file and re-test:
$ touch argh
$ ls *[!abc]*
argh d
To exclude file names that contain those characters anywhere, use:
$ shopt -s extglob
$ ls !(*[abc]*)
d
Another way of doing it (again with extended globs) would be to explicitly list out the patterns:
$ ls !(*a*|*b*|*c*)
d
thanks thats exactly what i needed
â amendeep singh
Sep 22 at 19:32
add a comment |Â
up vote
0
down vote
accepted
up vote
0
down vote
accepted
Your command does something very similar to what you want: it expands to the list of filenames that are not exactly: a
, b
, or c
. If you test, you see:
$ touch a b c d
$ ls *[!abc]*
d
But if you create another file and re-test:
$ touch argh
$ ls *[!abc]*
argh d
To exclude file names that contain those characters anywhere, use:
$ shopt -s extglob
$ ls !(*[abc]*)
d
Another way of doing it (again with extended globs) would be to explicitly list out the patterns:
$ ls !(*a*|*b*|*c*)
d
Your command does something very similar to what you want: it expands to the list of filenames that are not exactly: a
, b
, or c
. If you test, you see:
$ touch a b c d
$ ls *[!abc]*
d
But if you create another file and re-test:
$ touch argh
$ ls *[!abc]*
argh d
To exclude file names that contain those characters anywhere, use:
$ shopt -s extglob
$ ls !(*[abc]*)
d
Another way of doing it (again with extended globs) would be to explicitly list out the patterns:
$ ls !(*a*|*b*|*c*)
d
answered Sep 22 at 19:26
Jeff Schaller
33.3k849111
33.3k849111
thanks thats exactly what i needed
â amendeep singh
Sep 22 at 19:32
add a comment |Â
thanks thats exactly what i needed
â amendeep singh
Sep 22 at 19:32
thanks thats exactly what i needed
â amendeep singh
Sep 22 at 19:32
thanks thats exactly what i needed
â amendeep singh
Sep 22 at 19:32
add a comment |Â
Would you please add more description. In addition, example and the expected output.
â Goro
Sep 22 at 19:15