4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

macでsedコマンドを使う

4
Last updated at Posted at 2018-04-17

macでsedコマンドを実行するときに、Linuxと違った!という話

内容

macのターミナルでsedコマンドを実行する

やったこと

sedコマンドを実行してみる

jsonファイルに対して、置換してみる。

sed -i -e "s/AAA/BBB/g" *.json

はい、エラーですね。

sed: RE error: illegal byte sequence

sedコマンドを環境変数付きで実行

なんか環境変数を混ぜる?と正常に実行できた

LC_ALL=C sed -i -e "s/AAA/BBB/g" *.json

ちなみにオプションの内容は、
-i は置換後の内容を上書き
-e はバックアップ
って感じ

LinuxのRedHat系はこんなことしなくてもよかったのにー
って思ってハマったやつでした

4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?