I am attempting to list files that don't end in gz
I have a minimal working example:
ll chrX_PAR1.phased.vcf.gz | grep -v gz$
should show empty, but the file still shows, with or without quotes.
I have also tried
ll chrX_PAR1.phased.vcf.gz | grep -vP gz$
but this fails as well.
ll chrX_PAR1.phased.vcf.gz | grep -vE 'gz$'
also fails.
I have read Correct regex not working in grep and Anchors not working with grep but I don't see anything there that would solve this problem.
grep
example or about listing the files, because!(*.gz)
would expand to the list of non-hidden filenames that don't end in.gz
inbash
if you enable theextglob
shell option. – Kusalananda May 17 '22 at 22:00ll chrX_PAR1.phased.vcf.gz | LC_ALL=C sed -n l
? – Stéphane Chazelas May 17 '22 at 22:02type ll
?ll
is not a standard command, but is often found as an alias forls -l
with possibly other options – Stéphane Chazelas May 17 '22 at 22:03type ll
showsll is aliased to
ls -alF'` – con May 17 '22 at 22:03-F
, if thegz
file had execute permissions, you'd get a*
appended. Andsed -n l
would show...gz*$
($
to show the end of line) – Stéphane Chazelas May 17 '22 at 22:05ll chrX_PAR1.phased.vcf.gz | grep -v 'gz$'
still shows the file – con May 17 '22 at 22:05set -n l
output which is more portable and more usable thancat -A
for that purpose. – Stéphane Chazelas May 17 '22 at 22:10ls
is aliased to (type ls
). If it was aliased tols --color=always
, you'd likely get colour-reset escape sequences after the file name. – Stéphane Chazelas May 17 '22 at 22:13grep
command.
– con May 17 '22 at 22:14ls --color=never -l chrX_PAR1.phased.vcf.gz | grep -v gz$
works. If you write this down, I'll accept your answerll chrX_PAR1.phased.vcf.gz | LC_ALL=C sed -n l
. Did you try that? – Stéphane Chazelas May 17 '22 at 22:15ll chrX_PAR1.phased.vcf.gz | LC_ALL=C sed -n l
gives
– con May 17 '22 at 22:17-rw-r--r-- 1 con domain users 5018 Sep 18 2020 \033[0m\033[01;\ 31mchrX_PAR1.phased.vcf.gz\033[0m$