字串小幫手 on linux


Posted by Rich on 2021-08-10

grep

grep 是把資料裡面有我們要的關鍵字那整行取下來。

  • grep 的幾個指令:
    • -a:將 binary 以 text 檔案的方式進行搜尋
    • -c:計算找到‘搜尋字串’的次數
    • -i:忽略大小寫差異
    • -n:輸出行號
    • -v:輸出沒有‘搜尋字串’的資料
    • --color=auto:幫文字上色

grep 'rich' 把有“rich"的行全部取下來。
grep -v 'rich' 把沒有“rich"的行全部取下來。
搭配正規表示法,才能真正發揮 grep 的實力。


#筆記







Related Posts

Unveiling the Mystery: Understanding the Black Dot on Your Tooth

Unveiling the Mystery: Understanding the Black Dot on Your Tooth

Web開發學習筆記19 — Git

Web開發學習筆記19 — Git

Longest Common Prefix

Longest Common Prefix


Comments