您好我想在linux下面的命令输出是输出
addr {
bus: "scsi"
index: 0
}
vmdisk_uuid: "00aa6d13-e9e1-4df8-8af3-0a326489130f"
container_id: 774
vmdisk_size: 268435456000
addr {
bus: "scsi"
index: 1
}
vmdisk_uuid: "5b006fe4-a15c-490a-b589-5cdbc1dca155"
source_nfs_path: "/SureContainer/OCB/manual_81E33418-AC72-4D02-B9D2-0CF31D3B0EED/0E704F98-0EBF-4FB4-B538-142B7D0AA8F4_99999.raw"
container_id: 774
vmdisk_size: 536870912
addr {
bus: "scsi"
index: 2
}
vmdisk_uuid: "3b6b4229-ae76-42b0-815f-e2f6ee4d51e4"
source_nfs_path: "/SureContainer/OCB/manual_81E33418-AC72-4D02-B9D2-0CF31D3B0EED/0E704F98-0EBF-4FB4-B538-142B7D0AA8F4_99999.raw"
container_id: 774
vmdisk_size: 536870912
addr {
bus: "scsi"
index: 3
}
vmdisk_uuid: "187f0a54-00ae-49c9-929e-c85d7fcdcc51"
source_nfs_path: "/SureContainer/OCB/manual_81E33418-AC72-4D02-B9D2-0CF31D3B0EED/0E704F98-0EBF-4FB4-B538-142B7D0AA8F4_99999.raw"
container_id: 774
vmdisk_size: 536870912
addr {
bus: "scsi"
index: 4
}
vmdisk_uuid: "9dbad5d7-fc19-44fe-8652-8579a337c337"
source_nfs_path: "/SureContainer/OCB/manual_81E33418-AC72-4D02-B9D2-0CF31D3B0EED/0E704F98-0EBF-4FB4-B538-142B7D0AA8F4_99999.raw"
container_id: 774
vmdisk_size: 536870912
我在下面用命令
试了一下acli vm.disk_get SureMC | grep -e index -e source_nfs_path |grep -v "index: 0" | awk '{print $2}'
我能够将上面的输出分析到下面
1
"/SureContainer/OCB/manual_81E33418-AC72-4D02-B9D2-0CF31D3B0EED/0E704F98-0EBF-4FB4-B538-142B7D0AA8F4_99999.raw"
2
"/SureContainer/OCB/manual_81E33418-AC72-4D02-B9D2-0CF31D3B0EED/0E704F98-0EBF-4FB4-B538-142B7D0AA8F4_99999.raw"
3
"/SureContainer/OCB/manual_81E33418-AC72-4D02-B9D2-0CF31D3B0EED/0E704F98-0EBF-4FB4-B538-142B7D0AA8F4_99999.raw"
4
"/SureContainer/OCB/manual_81E33418-AC72-4D02-B9D2-0CF31D3B0EED/0E704F98-0EBF-4FB4-B538-142B7D0AA8F4_99999.raw"
但是我期待低于输出,我无法做到这一点,请帮助
1="/SureContainer/OCB/manual_81E33418-AC72-4D02-B9D2-0CF31D3B0EED/0E704F98-0EBF-4FB4-B538-142B7D0AA8F4_99999.raw"
2="/SureContainer/OCB/manual_81E33418-AC72-4D02-B9D2-0CF31D3B0EED/0E704F98-0EBF-4FB4-B538-142B7D0AA8F4_99999.raw"
3="/SureContainer/OCB/manual_81E33418-AC72-4D02-B9D2-0CF31D3B0EED/0E704F98-0EBF-4FB4-B538-142B7D0AA8F4_99999.raw"
4="/SureContainer/OCB/manual_81E33418-AC72-4D02-B9D2-0CF31D3B0EED/0E704F98-0EBF-4FB4-B538-142B7D0AA8F4_99999.raw"
由于
答案 0 :(得分:1)
你可以试试这个,
acli vm.disk_get SureMC | grep -e index -e source_nfs_path a | grep -v "index: 0" |sed 'N;s/\n/ /' | awk '{ print $2,$4}' OFS="="
(OR)
acli vm.disk_get SureMC | grep -e index -e source_nfs_path a | grep -v "index: 0" | awk '{print $2}' | sed 'N;s/\n/=/'