- 论坛徽章:
- 0
|
回复 1# lbt5210
这个意思?- ywlscpl@ubuntu:~$ awk '{v=v"\n"$0}/fixed/{ip=$2}/}/{a[ip]=v;v=""}END{n=asorti(a,b);for (i=1;i<=n;i++) print a[b[i]]}' file
- host D8PDD003
- {
- hardware ethernet 00:E0:4C:30:EA:44;
- fixed-address 10.0.42.100;
- }
- host D8PDD004
- {
- hardware ethernet 00:E0:4C:60:8C:9D;
- fixed-address 10.0.42.101;
- }
- host D8PDD001
- {
- hardware ethernet 00:40:05:43:06:5F;
- fixed-address 10.0.42.113;
- }
- host D8JJD001
- {
- hardware ethernet 00:14:78:57:35:27;
- fixed-address 10.0.42.177;
- }
- host D8JJD002
- {
- hardware ethernet 00:15:f2:a0:1f:bb;
- fixed-address 10.0.42.178;
- }
- host D8PDD002
- {
- hardware ethernet 00:E0:4C:22:AC:95;
- fixed-address 10.0.42.203;
- }
复制代码 |
评分
-
查看全部评分
|