Create multiple-sed-example.sh

This commit is contained in:
kneutron 2022-04-14 11:13:04 -05:00 committed by GitHub
parent a59fda6056
commit 8e91c13251
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

40
multiple-sed-example.sh Normal file
View File

@ -0,0 +1,40 @@
#!/bin/bash
# convert short disk names to long OTF, should also work fine with zpool iostat
zpool status -v \
|awk 'NF>0' \
|sed 's/sdp/ata-ST4000VN000-1H4168_Z3073Z7/;s/sdo/ata-ST4000VN000-1H4168_Z3076XV/;s/sdn/ata-ST4000VN008-2DR166_ZDHB3DR/;s/sdm/ata-ST4000VN008-2DR166_ZDHB41B/;s/sdd/ata-ST4000VN008-2DR166_ZDHBCLL/;s/sdc/ata-ST4000VN008-2DR166_ZDHBDGP/'
exit;
Given:
pool: zseatera4
state: ONLINE
config:
NAME STATE READ WRITE CKSUM
zseatera4 ONLINE 0 0 0
raidz2-0 ONLINE 0 0 0
sdc ONLINE 0 0 0
sdd ONLINE 0 0 0
sdp ONLINE 0 0 0
sdo ONLINE 0 0 0
sdn ONLINE 0 0 0
sdm ONLINE 0 0 0
errors: No known data errors
Outputs:
pool: zseatera4
state: ONLINE
config:
NAME STATE READ WRITE CKSUM
zseatera4 ONLINE 0 0 0
raidz2-0 ONLINE 0 0 0
ata-ST4000VN008-2DR166_ZDHBDGP ONLINE 0 0 0
ata-ST4000VN008-2DR166_ZDHBCLL ONLINE 0 0 0
ata-ST4000VN000-1H4168_Z3073Z7 ONLINE 0 0 0
ata-ST4000VN000-1H4168_Z3076XV ONLINE 0 0 0
ata-ST4000VN008-2DR166_ZDHB3DR ONLINE 0 0 0
ata-ST4000VN008-2DR166_ZDHB41B ONLINE 0 0 0
errors: No known data errors