
[Linux] 刪除文件中包含有特定字串的一整行
“ 刪除文件中包含有特定字串的一整行Delete all rows that contain a specific string (text) ”
此文完整連結 http://n.sfs.tw/m10716
複製連結 [Linux] 刪除文件中包含有特定字串的一整行@精讚(文章歡迎轉載,請尊重版權註明連結來源)
2021-03-03 11:04:48 By 張○○
因為我的記錄檔很多垃圾,想要把記錄檔中不必要的資訊過濾掉,
有個簡單的awk指令:
$ awk '!/your_string/' file > newfile
如果要取出特定字串一整行,可以用grep或awk
$ awk '/your_string/' file > newfile
$ grep 'your_string' file > newfile
[相關連結]
https://www.unix.com/unix-for-dummies-questions-and-answers/161689-delete-all-rows-contain-specific-string-text.html
你可能有興趣
[Linux] 刪除文件中包含有特定字串的一整行
刪除文件中包含有特定字串的一整行Delete all rows that contain a specific string (text)
HTTP的GET METHOD
使用http 的get 方法取得網頁資料
[Linux] wget 指定資料匣和wget 略過https的檢查
遇到失效的https網頁,wget無法抓檔,怎麼解決?
免費抓畫面軟體 Greenshot
明明Windows就已經有附畫面截取工具,為什麼還要推薦這個?
[PHP] 由於 scheme 不同,Cookie「_ga」在未來會被視為對XXX的跨網站 cookie
最近發現主控台出現這類的警告,很煩人…
[Mac] Forticlient 'Connection Error' '連接錯誤'
mac 筆電上的 forticlient突然不能連了,不知發生什麼事?