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.
grepexample or about listing the files, because!(*.gz)would expand to the list of non-hidden filenames that don't end in.gzinbashif you enable theextglobshell 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?llis not a standard command, but is often found as an alias forls -lwith possibly other options – Stéphane Chazelas May 17 '22 at 22:03type llshowsll is aliased tols -alF'` – con May 17 '22 at 22:03-F, if thegzfile had execute permissions, you'd get a*appended. Andsed -n lwould 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 loutput which is more portable and more usable thancat -Afor that purpose. – Stéphane Chazelas May 17 '22 at 22:10lsis 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:13grepcommand.
– 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 lgives
– 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$