- 论坛徽章:
- 2
|
- [root@CentOS_6 experiment]# awk -F [\(:\)] '{split($2,array,"\.");printf("%-3s%-13s%-4s%-6s%-3s%-3s\n","ip",$2,"dir",$3,"id",array[4]);}' a.txt ^C
- [root@CentOS_6 experiment]# cat a.txt
- ls_list+=(192.168.10.1:game1)
- ls_list+=(192.168.10.2:game2)
- ls_list+=(192.168.10.3:game3)
- ls_list+=(192.168.10.4:game4)
- ls_list+=(192.168.10.5:game5)
- [root@CentOS_6 experiment]# awk -F [\(:\)] '{split($2,array,"\.");printf("%-3s%-13s%-4s%-6s%-3s%-3s\n","ip",$2,"dir",$3,"id",array[4]);}' a.txt
- awk: 警告: 转义序列“\.”被当作单纯的“.”
- ip 192.168.10.1 dir game1 id 1
- ip 192.168.10.2 dir game2 id 2
- ip 192.168.10.3 dir game3 id 3
- ip 192.168.10.4 dir game4 id 4
- ip 192.168.10.5 dir game5 id 5
复制代码 |
|