特定のファイルのテキストを編集したい

特定のファイルのテキストを編集したい

以下のように設定ファイルを変更したいと思います。シェルスクリプトで何ができますか?

今後

Section "InputClass"
        Identifier      "calibration"
        MatchProduct    "Touch"
        Option  "Calibration"   "166 3939 186 3814"
        Option  "SwapAxes"      "1"
        Option  "InvertX"   "on"
        Option  "InvertY"   "on"
EndSection

後ろに

Section "InputClass"
        Identifier      "calibration"
        MatchProduct    "Touch"
        Option  "Calibration"   "166 3939 186 3814"
        Option  "SwapAxes"      "1"
        Option  "InvertX"   "off"
        Option  "InvertY"   "on"
EndSection

ベストアンサー1

でも

sed -i '/InvertX/s/"on"/"off"/' file_name

おすすめ記事