User Tools

Site Tools


bash:list_files_excluding_some_files

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
bash:list_files_excluding_some_files [2020/07/15 09:30] – external edit 127.0.0.1bash:list_files_excluding_some_files [2021/01/26 12:14] (current) – removed peter
Line 1: Line 1:
-====== BASH - List files excluding some files ====== 
- 
-Without enabled globbing files can be excluded by the second command of this code section: 
- 
-<code bash> 
-# See all files ending in .html 
-ls | grep "\.html$" 
-# see all files not ending in .html 
-ls | grep -v "\.html$" 
-</code> 
- 
-If extended globbing is turned on, one should be able to execute 
- 
-<code bash> 
-printf "%s\n" *!(.html) 
-</code> 
- 
-in ksh and bash but I wasn't. I have this command from a forum so there's a chance that either my shell isn't working properly or the syntax has changed in the meantime. 
- 
-In zsh you enable globbing by inserting setopt extendedglob in .zshrc 
- 
-In the zsh this should work 
- 
-<code bash> 
-ls path/*!(.html) 
-</code> 
- 
-but I get zsh: number expected. 
- 
-Even though it's not working yet it's worth to add these commands to this list as the issue can be fixed by reading some more documentation like [[http://zsh.sourceforge.net/Doc/zsh_a4.pdf|this one]] or [[http://pwet.fr/man/linux/commandes/zsh_lovers|this one]]. At the moment I have no time to continue fixing. 
  
bash/list_files_excluding_some_files.1594805433.txt.gz · Last modified: 2020/07/15 09:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki