- 论坛徽章:
- 0
|
如下:
设置RS=c1后,a变量输出不同,为什么?- [root@root-linux ]$ awk '/AAA/,/BBB/{a=$0;RS=c1;print a}' t3
- AAA
- ndc-mon2
- -------------------------------------------
- c1 Disk ENABLED Disk
- c3 GENESIS ENABLED USP4
- c4 GENESIS ENABLED USP4
- BBB
- ndc-mon3
- -------------------------------------------
- c2 AMS_WMS ENABLED AMS2
- c3 AMS_WMS ENABLED AMS2
- c3 TagmaStore-USP ENABLED USP4
- c2 TagmaStore-USP ENABLED USP4
- c1 Disk ENABLED disk
- [root@root-linux ]$ awk '/AAA/,/BBB/{a=$0;print a}' t3
- AAA
- ndc-mon2
- -------------------------------------------
- c1 Disk ENABLED Disk
- c3 GENESIS ENABLED USP4
- c4 GENESIS ENABLED USP4
- BBB
- [root@root-linux ]$ cat t3
- ndc-mon1
- -------------------------------------------
- c1 Disk ENABLED Disk
- c3 GENESIS ENABLED USP4
- c4 GENESIS ENABLED USP4
- AAA
- ndc-mon2
- -------------------------------------------
- c1 Disk ENABLED Disk
- c3 GENESIS ENABLED USP4
- c4 GENESIS ENABLED USP4
- BBB
- ndc-mon3
- -------------------------------------------
- c2 AMS_WMS ENABLED AMS2
- c3 AMS_WMS ENABLED AMS2
- c3 TagmaStore-USP ENABLED USP4
- c2 TagmaStore-USP ENABLED USP4
- c1 Disk ENABLED disk
复制代码 |
|