1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【sedコマンド】特定ファイル内すべてのダブルクォーテーションを削除

Last updated at Posted at 2021-08-26
  • 特定のファイル内のダブルクォーテーションを削除するコマンド
    • -i ... ファイルを上書きするオプション
    • -e ... 正規表現のオプション(他のオプションを利用しない場合や、別ファイル保存の場合は不要
# ダブルクォーテーションを削除して、上書き
sed -i -e 's/"//g' result.csv

# 結果を確認
head result.csv

削除した結果を 別ファイルで保存 したい場合
(元のファイルは保持しておきたい場合)

# ダブルクォーテーションを削除して、別ファイル(result_edited.csv)として保存
sed 's/"//g' result.csv > result_edited.csv

# 結果を確認
head result.csv
head result_edited.csv
1
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?