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.
我使用 ${var//string1/string2} 替换字符或字符串,现在我需要在特定列 awk 中执行相同操作。
尝试这个替换每个“_”的空间,但不起作用
cat file | awk -F',' '{print ${3// /_}'
使用gsub
awk -F, -v OFS=, '{gsub(" ", "_", $3); print}' file.txt