Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
次のようなファイルがあります。
'abc', '123' 'abc', '123' 'abc', '123' 'abc', '123' 'abc', '123' 'abc', '123'
列 2 のみの一重引用符を置き換えたいです。次の AWK コマンドを試しましたが、機能しません。
awk 'BEGIN {FS=","} { if(NF==2){gsub("\047", "")}; print $0}' file.txt
または:
$ awk -v replace="'" '{gsub(replace,"",$2)}1' file 'abc', 123 'abc', 123 'abc', 123 'abc', 123 'abc', 123 'abc', 123