linux grep 指定檔案字尾名搜尋

2021-08-27 23:06:05 字數 457 閱讀 6897

在安裝的solr裡找一些單詞, 使用grep 寫法如下:

#pwd

/opt/solr/solr/hbase_f_trademark_info_index_tbs/conf

# grep "hbase_f_trademark_info_index_tbs" * 

表示在當前目錄下所有檔案找單詞 hbase_f_trademark_info_index_tbs

命令格式如下:

[root@hadoop3 ~]#   grep --help

usage: grep [option]... pattern [file]...

在查詢字串時,有時需要指定檔案字尾方式查詢,命令如下:

grep -rn --include="*.properties" 'tableissharding' ./*

刪除指定目錄下指定字尾的檔案

定時清除計畫任務日誌檔案,避免占用太大磁碟空間 folderpath www server log 要操作的目錄 deltype array log foreach deltype as file type param path資料夾絕對路徑 file type待刪除檔案的字尾名 return vo...

iOS檔案操作,刪除指定字尾檔案

ios開發獲取path路徑下資料夾大小 nsstring getcachesizewithfilepath nsstring path 5.指定路徑,獲取這個路徑的屬性 nsdictionary dict nsfilemanager defaultmanager attributesofitemat...

php修改指定檔案字尾的方法

因專案需求,需要將asp字尾的修改成php,因懶於乙個個修改。又覺得php跟qt一樣都是高階語言了,一般高階語言都有提供對獲得的內容進行增刪改查的函式。經過一番資料查詢與 測試,總結出了php修改指定檔案字尾的方法,分享給大家。目標 將當前目錄下的asp字尾改成php,而不影響其它 字尾格式的檔案 ...