开发者

OS X Bash list files excluding items from input file

开发者 https://www.devze.com 2023-04-01 22:33 出处:网络
I need to list the contents of a directory, but exclude a list of known files which are in a plain text file. I\'m assuming using grep or input re开发者_如何转开发direction or possibly a while loop bu

I need to list the contents of a directory, but exclude a list of known files which are in a plain text file. I'm assuming using grep or input re开发者_如何转开发direction or possibly a while loop but am stuck.

The following works but is long winded:

 ls ~/Library/Fonts | grep -v 'Onyx\|Playbill\|Georgia\|Garamond\|Tahoma\|Verdana\|Microsoft'

Any help appreciated.


ls | grep -v -F -f exclude.file

grep man page

0

精彩评论

暂无评论...
验证码 换一张
取 消