sed(stream editor ) 可以和正規表達式結合 在文本當中進行文本的替換
1 最基本形式:sed 's/pattern/relace_string/' filename 将比對到到的每行第一處替換
2 可以重定向到一個新檔案當中在末尾加上> newfilename 或者 -i 将替換應用到源檔案
3 全部替換: 's/pattern/relace_string/g' 加上 /g
4 若加上/ng n表示從第n個開始替換
5 移除空格 '/^s/d' d 指的是 删除
6 已比對的進行标記 &
7 子字元串 \1 \2 放在替換文本的位置 表示 :替換比對字元串的是字元串的第1或第者2個子字元串