カンマをタブに置換する †カンマ区切りのCSVをタブ区切りのTSVに変更したい場合、以下のコマンドにより簡単に置換することができます。 使用した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コマンド †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コマンド †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 リダイレクトすればファイルへ出力することもできますね。 以上、カンマをタブに置換するコマンドの紹介でした。 |