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.
私はこの awk ステートメントを持っており、正常に動作しています
awk '{a= a","$1}END{print a}' file.txt
出力で $1 フィールド shoube を一重引用符で囲みたい
どうすればそれができますか
一方通行:
awk -v q="'" '{a= a","q$1q}END{print a}' file.txt
別の方法:
awk '{a= a",\x27"$1"\x27"}END{print a}' file.txt
awk '{a= a",'"'"'"$1"'"'"'"}END{print a}' file.txt
別:
awk '{a= a",'\''"$1"'\''"}END{print a}' file.txt