The content of this section:
The awk command implements the concatenation of strings
Enter the contents of the file:
Tmall_inventory_30_group my163149.cm6 3506 5683506 mysql-bin. 000013327359057 tmall_inventory_31_group my163149.cm6 3606 5683606 mysql-bin. 000017301259529 $1 $2 $3 $ 4 $5 $6
Goal:
Tmall_inventory_30_group 000013.327359057#5683506.0
Awk
awk '{position=$5 ': "$6" # "$4; print $, position}'[.] ' ' {print $1,$2 "." 0}'{print $1,$3}'
string concatenation, using double quotes "", to concatenate strings on both sides
Output
Tmall_inventory_30_group Mysql-bin 000013:327359057#5683506.0
Tmall_inventory_31_group Mysql-bin 000017:301259529#5683606.0
If you enter:
awk '{position=$5 ': "$6" # "$4; print $, position}'[.] ' ' {print $1,$2 "." 0}'
The output:
Tmall_inventory_30_group Mysql-bin 000013:327359057#5683506.0
Tmall_inventory_31_group Mysql-bin 000017:301259529#5683606.0
If you enter:
$ awk '{position=$5 ': "$6" # "$4; print $, position}' posi.txt
The output:
Tmall_inventory_30_group mysql-bin.000013:327359057#5683506
Tmall_inventory_31_group mysql-bin.000017:301259529#5683606
Here are some examples of how the awk command implements string concatenation, which can be useful for log analysis and routine maintenance, using the awk command in Linux.
Shell awk command string concatenation