===================================
dell1-node1.lvs.local
Device: t10.ATA_____DENCSTE251M252D0115______________________A09AY011202000268000000
VSANUUID: 5229819d-8308-e6a3-fea1-0716a6432ecd
SSD: True
Capacity: 79830188032
CapacityUsed: 0
DiskHealh: OK
Device: t10.ATA_____ST1000VX0012D1HH162__________________________________S513WZVV
VSANUUID: 526b1573-6e2e-111e-9748-a67d18a0093f
SSD: False
Capacity: 990191288320
CapacityUsed: 526032830464
DiskHealh: OK
===================================
dell1-node4.lvs.local
Device: t10.ATA_____ST2000VX0032D1HH164__________________________________W7208JYX
VSANUUID: 52219120-9951-3037-a871-11571eccf50e
SSD: False
Capacity: 1980382576640
CapacityUsed: 1337030868992
DiskHealh: OK
Device: t10.ATA_____DENCSTE251M252D0115______________________A09AY011210000027000000
VSANUUID: 52252706-4dcb-c73c-19f5-67719c29d0f6
SSD: True
Capacity: 79830188032
CapacityUsed: 0
DiskHealh: OK
===================================
dell1-node3.lvs.local
Device: naa.5000c5008c23ab53
VSANUUID: 5213b511-11b8-5f64-cb03-5a2d6ad258fa
SSD: False
Capacity: 990191288320
CapacityUsed: 682308403200
DiskHealh: OK
Device: naa.5000c5008c23ac7a
VSANUUID: 5236dc9a-b087-c2d8-2d24-2433218f3352
SSD: False
Capacity: 990191288320
CapacityUsed: 652595953664
DiskHealh: OK
Device: naa.5e83a97010008946
VSANUUID: 52f99ae4-970c-7369-de9d-7b93f0d9b5df
SSD: True
Capacity: 79830188032
CapacityUsed: 0
DiskHealh: OK
大家好,我需要将此字符串复制到文件中:
dell1-node4.lvs.local
Device: t10.ATA_____ST2000VX0032D1HH164__________________________________W7208JYX
VSANUUID: 52219120-9951-3037-a871-11571eccf50e
SSD: False
Capacity: 1980382576640
CapacityUsed: 1337030868992
DiskHealh: OK
Device: t10.ATA_____DENCSTE251M252D0115______________________A09AY011210000027000000
VSANUUID: 52252706-4dcb-c73c-19f5-67719c29d0f6
SSD: True
Capacity: 79830188032
CapacityUsed: 0
DiskHealh: OK
然后继续将此字符串复制到另一个文件:
t10.ATA_____DENCSTE251M252D0115______________________A09AY011210000027000000
VSANUUID: 52252706-4dcb-c73c-19f5-67719c29d0f6
SSD: True
Capacity: 79830188032
CapacityUsed: 0
DiskHealh: OK
答案 0 :(得分:0)
如果您希望将“====”之间的所有内容存储在给定文件中,这将起作用。我也在我的系统上测试过它。祝你好运!
print_source_of_block
awk '/dell/{flag=1;next}/=/{flag=0}flag' <filename> > dell1-node4.lvs.local
匹配包含此文字的行,以及/dell/
。
/=/
在找到文本/dell/{flag=1;next}
时设置标记。
然后,它会跳过这条线。
dell
在找到文字/=/{flag=0}
时取消设置标记。
最终标志是具有默认操作的模式,即
打印=
如果标志等于1,则打印该行。