2012-07-25 129 views
0

假設我想查找某個文件系統上的特定內容,但省略搜索中的某些目錄。我想輸入locate string[omit anything which resides in specified directory]正則表達式:省略查找字符串

舉個例子,比方說,我想省略清單中的/usr/share

這是如何完成的?

回答

2
locate string | grep -v ^/usr/share 

或者,如果你有find搜索,使用-prune

find/-name \*string\* \(-path '/usr/share' -prune -o -print \) 
相關問題