- 论坛徽章:
- 0
|
本帖最后由 lionfun 于 2012-01-16 19:51 编辑
回复 1# dashorc
我也来试一个一般般的 - [root@local ~]# awk 'NR==FNR{a[$1$2]="l5_mod_id=\""$3"\"";next}NR>FNR && /forward/{t=$5;gsub(/l5_mod_id=|"/,"",$4);gsub(/l5_cmd_id=|"/,"",$5);$4=a[$4$5];$5=t}1' file1.txt file2.txt
- <!-- Name:0x25 -->
- <forward cmd="0x25" sub_cmd="any" l5_mod_id="28362" l5_cmd_id="0" protocol="udp" conn_pool_size="1" />
- <!-- Name:0x09 r -->
- <forward cmd="0x09" sub_cmd="0x00" l5_mod_id="28298" l5_cmd_id="0" protocol="udp" conn_pool_size="1" />
- <forward cmd="0x09" sub_cmd="0x02" l5_mod_id="28298" l5_cmd_id="0" protocol="udp" conn_pool_size="1" />
- <forward cmd="0x09" sub_cmd="0x03" l5_mod_id="28298" l5_cmd_id="0" protocol="udp" conn_pool_size="1" />
- <!-- Name:0x09 w -->
- <forward cmd="0x09" sub_cmd="0x01" l5_mod_id="28234" l5_cmd_id="1" protocol="udp" conn_pool_size="1" />
- <forward cmd="0x09" sub_cmd="0x04" l5_mod_id="28234" l5_cmd_id="1" protocol="udp" conn_pool_size="1" />
复制代码 |
|