LoginSignup
1
3

More than 5 years have passed since last update.

シェルスクリプトでテキストから改行を取り除くたった一つの方法

Last updated at Posted at 2017-05-20

ネタが細かすぎるのでQiitaに書く。

tr コマンドを使う

tr -d "\n"

いつも忘れるんですよね・・・。忘れて sed -e "s/\n//g" とか書いちゃう。反省。

例えば、JSONファイルから改行、タブ文字、空白を取り除く場合以下のようにする具合。(文字列中の該当文字も消えるので注意)

cat hoge.json | tr -d "\n\t "
1
3
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
1
3