📜  awk 如何打印而不在字段之间添加空格 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:50:57.297000             🧑  作者: Mango

代码示例1
# Short answer:
# If you're getting unwanted spaces between the items you're printing 
# with awk you probably need to remove commas between the items.

# Example of problem:
awk '{print $1, "some-text", $2}' file_to_parse # $1 and $2 are the 
# first and second fields/columns of the the file_to_parse
--> field_1 some text field_2 # Output

# If you didn't want spaces, remove the commas:
awk '{print $1 "some-text" $2}' file_to_parse
--> field_1some-textfield_2 # Output