以下の内容はhttps://takuya-1st.hatenablog.jp/entry/2014/02/21/154039より取得しました。


コマンド 実行結果から改行を取り除いて一行にする。

コマンドの実行結果を一行にまとめたり、一行になったものを複数行に分割したいことが有りますよね

tr コマンドで置換

tr コマンドは translate word で文字を移動させるものですが。

takuya@rena:~/Downloads$ echo "abcdefgabcabca" | tr abc xyz
xyzdefgxyzxyzx

改行を置換

以下のコマンドは、with オプションを一覧するが、そのままだと使えない。

takuya@rena:~/Desktop$ brew info ffmpeg | grep ^--with | grep -v ^--without
--with-fdk-aac
--with-ffplay
--with-freetype
--with-frei0r
--with-libass
--with-libbluray
--with-libcaca
--with-libquvi
--with-libvo-aacenc
--with-libvorbis
--with-libvpx
--with-opencore-amr
--with-openjpeg
--with-openssl
--with-opus
--with-rtmpdump
--with-schroedinger
--with-speex
--with-theora
--with-tools

そこで一行にまとめる。

tr を使って複数行を一行にまとめる。

brew info ffmpeg | grep ^--with | grep -v ^--without  | tr '\n' ' '
--with-fdk-aac --with-ffplay --with-freetype --with-frei0r --with-libass --with-libbluray --with-libcaca --with-libquvi --with-libvo-aacenc --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with-openssl --with-opus --with-rtmpdump --with-schroedinger --with-speex --with-theora --with-tools

sed でもできるけど。。。sedGNU sedOSXBSD sed で動作が違うから面倒だよね。




以上の内容はhttps://takuya-1st.hatenablog.jp/entry/2014/02/21/154039より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14