"文字を削除するには、ファイルの種類を指定してください。

次のデータを含むファイルがあります。

"MG1507XXXXXX|" "|020000XXXXXX" "20261031|"     "|3,827.92"     "|3,581.41"     "|542,729.62"   "MBA"
"MG1507XXXXXX|" "|020000XXXXXX" "20261130|"     "|3,680.15"     "|3,729.18"     "|539,000.44"   "MBA"
"MG1507XXXXXX|" "|020000XXXXXX" "20261231|"     "|3,776.70"     "|3,632.63"     "|535,367.81"   "MBA"
"MG1507XXXXXX|" "|020000XXXXXX" "20270131|"     "|3,751.24"     "|3,658.09"     "|531,709.72"   "MBA"
"MG1507XXXXXX|" "|020000XXXXXX" "20270228|"     "|3,365.07"     "|4,044.26"     "|527,665.46"   "MBA"
"MG1507XXXXXX|" "|020000XXXXXX" "20270331|"     "|3,697.28"     "|3,712.05"     "|523,953.41"   "MBA"
"MG1507XXXXXX|" "|020000XXXXXX" "20270430|"     "|3,552.84"     "|3,856.49"     "|520,096.92"   "MBA"
"MG1507XXXXXX|" "|020000XXXXXX" "20270531|"     "|3,644.24"     "|3,765.09"     "|516,331.83"   "MBA"
"MG1507XXXXXX|" "|020000XXXXXX" "20270630|"     "|3,501.16"     "|3,908.17"     "|512,423.66"   "MBA"
"MG1507XXXXXX|" "|020000XXXXXX" "20270731|"     "|3,590.47"     "|3,818.86"     "|508,604.80"   "MBA"
"MG1507XXXXXX|" "|020000XXXXXX" "20270831|"     "|3,563.72"     "|3,845.61"     "|504,759.19"   "MBA"
"MG1507XXXXXX|" "|020000XXXXXX" "20270930|"     "|3,422.68"     "|3,986.65"     "|500,772.54"   "MBA"
"MG1507XXXXXX|" "|020000XXXXXX" "20271031|"     "|3,508.84"     "|3,900.49"     "|496,872.05"   "MBA"

どのように変更したい、どのように見えるようにしたいですか?

MG1507XXXXXX|020000XXXXXX|20261031|3,827.92|3,581.41|542,729.62|MBA|
MG1507XXXXXX|020000XXXXXX|20261130|3,680.15|3,729.18|539,000.44|MBA|
MG1507XXXXXX|020000XXXXXX|20261231|3,776.70|3,632.63|535,367.81|MBA|
MG1507XXXXXX|020000XXXXXX|20270131|3,751.24|3,658.09|531,709.72|MBA|
MG1507XXXXXX|020000XXXXXX|20270228|3,365.07|4,044.26|527,665.46|MBA|
MG1507XXXXXX|020000XXXXXX|20270331|3,697.28|3,712.05|523,953.41|MBA|
MG1507XXXXXX|020000XXXXXX|20270430|3,552.84|3,856.49|520,096.92|MBA|
MG1507XXXXXX|020000XXXXXX|20270531|3,644.24|3,765.09|516,331.83|MBA|
MG1507XXXXXX|020000XXXXXX|20270630|3,501.16|3,908.17|512,423.66|MBA|
MG1507XXXXXX|020000XXXXXX|20270731|3,590.47|3,818.86|508,604.80|MBA|
MG1507XXXXXX|020000XXXXXX|20270831|3,563.72|3,845.61|504,759.19|MBA|
MG1507XXXXXX|020000XXXXXX|20270930|3,422.68|3,986.65|500,772.54|MBA|
MG1507XXXXXX|020000XXXXXX|20271031|3,508.84|3,900.49|496,872.05|MBA|

これを達成するために何を使うべきかわかりません。どんなアイデアがありますか?

ベストアンサー1

2番目の文字から行末までのすべてのスペースと二重引用符をtr解釈し|s絞り込むことができます。cut

tr -s '[[:blank:]"]' \| <infile | cut -c2-

おすすめ記事