二重引用符で囲まれた文字列とその間のコンマで区切られた値を持つ CSV ファイルから列を削除するにはどうすればよいですか? 以下の形式のようなヘッダーを含む 4 行のファイル 44.csv があります。
column1, column2, column3, column 4, column5, column6
12,455,"string with quotes, and with a comma in between",4432,6787,890,88
4432,6787,"another, string with quotes, and with two comma in between",890,88,12,455
11,22,"simple string",77,777,333,22
ファイルから 1,2,3 列を切り取る必要があるため、以下のように cut コマンドを使用しました。
cut -d"," -f1,2,3 44.csv > 444.csv
私は次のように出力を得ています
column1, column2, column3
12,455,"string with quotes
4432,6787,"another string with quotes
11,22,"simple string"
しかし、私は出力が必要です
column1, column2, column3
12,455,"string with quotes, and with a comma in between"
4432,6787,"another, string with quotes, and with two comma in between"
11,22,"simple string"
どんな助けでも大歓迎です。
ありがとうドゥルヴ。