逆引きUNIXコマンド/カンマをタブに置換する
の編集
Top
/
逆引きUNIXコマンド
/
カンマをタブに置換する
[
トップ
] [
編集
|
差分
|
バックアップ
|
添付
|
リロード
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
-- 雛形とするページ --
(no template pages)
#navi(../) * カンマをタブに置換する [#i6ad8979] カンマ区切りのCSVをタブ区切りのTSVに変更したい場合、以下のコマンドにより簡単に置換することができます。 #contents #htmlinsertpcsp(linux_ads_top.html,linux-sp.html) * 使用したCSVファイル [#j4bc409a] #ref(in.csv) os,name linux,debian linux,ubuntu linux,centos windows,windows 7 windows,windows 8.1 windows,windows 10 bsd,openbsd bsd,netbsd bsd,freebsd * trコマンド [#v6503c66] trコマンドでカンマをタブに置換する cat CSVファイル名 | tr "," "\t" 実際に実行した時の出力です。~ $ cat in.csv | tr "," "\t" os name linux debian linux ubuntu linux centos windows windows 7 windows windows 8.1 windows windows 10 bsd openbsd bsd netbsd bsd freebsd リダイレクトすればファイルへ出力することもできますね。 * sedコマンド [#l1e64bf3] sedコマンドを使用する場合は以下の構文になります。 sed -e s/,/\\t/g ファイル名 実際に実行した時の出力です。~ $ sed -e s/,/\\t/g in.csv os name linux debian linux ubuntu linux centos windows windows 7 windows windows 8.1 windows windows 10 bsd openbsd bsd netbsd bsd freebsd リダイレクトすればファイルへ出力することもできますね。 以上、カンマをタブに置換するコマンドの紹介でした。 #htmlinsertpcsp(linux_ads_btm.html,linux-sp.html)
タイムスタンプを変更しない
#navi(../) * カンマをタブに置換する [#i6ad8979] カンマ区切りのCSVをタブ区切りのTSVに変更したい場合、以下のコマンドにより簡単に置換することができます。 #contents #htmlinsertpcsp(linux_ads_top.html,linux-sp.html) * 使用したCSVファイル [#j4bc409a] #ref(in.csv) os,name linux,debian linux,ubuntu linux,centos windows,windows 7 windows,windows 8.1 windows,windows 10 bsd,openbsd bsd,netbsd bsd,freebsd * trコマンド [#v6503c66] trコマンドでカンマをタブに置換する cat CSVファイル名 | tr "," "\t" 実際に実行した時の出力です。~ $ cat in.csv | tr "," "\t" os name linux debian linux ubuntu linux centos windows windows 7 windows windows 8.1 windows windows 10 bsd openbsd bsd netbsd bsd freebsd リダイレクトすればファイルへ出力することもできますね。 * sedコマンド [#l1e64bf3] sedコマンドを使用する場合は以下の構文になります。 sed -e s/,/\\t/g ファイル名 実際に実行した時の出力です。~ $ sed -e s/,/\\t/g in.csv os name linux debian linux ubuntu linux centos windows windows 7 windows windows 8.1 windows windows 10 bsd openbsd bsd netbsd bsd freebsd リダイレクトすればファイルへ出力することもできますね。 以上、カンマをタブに置換するコマンドの紹介でした。 #htmlinsertpcsp(linux_ads_btm.html,linux-sp.html)
テキスト整形のルールを表示する
添付ファイル:
in.csv
679件
[
詳細
]