我试图从文件搜索中排除某个字符串.
假设我有一个文件列表:file_Michael.txt,file_Thomas.txt,file_Anne.txt.
我希望能够写出类似的东西
ls *<and not Thomas>.txt
Run Code Online (Sandbox Code Playgroud)
给我file_Michael.txt和file_Anne.txt,但不是file_Thomas.txt.
反过来很容易:
ls *Thomas.txt
Run Code Online (Sandbox Code Playgroud)
使用单个字符执行此操作也很容易:
ls *[^s].txt
Run Code Online (Sandbox Code Playgroud)
但是怎么用字符串呢?
塞巴斯蒂安