Friday, September 19, 2008

Solaris save format output to file

# echo|format > format.out

This is useful when you have new disk/lun, and lazy to find out which one is new
And make it easy if you wnat to execute command as below

#metattach d017 /dev/dsk/c6t60060E8004F25E000000F25E000009E1d0


root@hostorap1 # grep -i warning /var/adm/messages
Sep 18 10:07:28 host scsi: [ID 107833 kern.warning] WARNING: /scsi_vhci/ssd@g60060e8004f25e000000f25e00000623 (ssd34):
Sep 18 10:07:28 host scsi: [ID 107833 kern.warning] WARNING: /scsi_vhci/ssd@g60060e8004f25e000000f25e00000622 (ssd35):
Sep 18 10:07:28 host scsi: [ID 107833 kern.warning] WARNING: /scsi_vhci/ssd@g60060e8004f25e000000f25e00000621 (ssd36):
Sep 18 10:07:28 host scsi: [ID 107833 kern.warning] WARNING: /scsi_vhci/ssd@g60060e8004f25e000000f25e00000620 (ssd37):
Sep 18 10:07:28 host scsi: [ID 107833 kern.warning] WARNING: /scsi_vhci/ssd@g60060e8004f25e000000f25e0000061f (ssd38):
Sep 18 10:07:28 host scsi: [ID 107833 kern.warning] WARNING: /scsi_vhci/ssd@g60060e8004f25e000000f25e0000061e (ssd39):
Sep 18 10:07:29 host scsi: [ID 107833 kern.warning] WARNING: /scsi_vhci/ssd@g60060e8004f25e000000f25e0000061d (ssd40):
Sep 18 10:07:29 host scsi: [ID 107833 kern.warning] WARNING: /scsi_vhci/ssd@g60060e8004f25e000000f25e0000061c (ssd41):
Sep 18 10:07:29 host scsi: [ID 107833 kern.warning] WARNING: /scsi_vhci/ssd@g60060e8004f25e000000f25e0000061b (ssd42):
Sep 18 10:07:29 hostorap1 scsi: [ID 107833 kern.warning] WARNING: /scsi_vhci/ssd@g60060e8004f25e000000f25e0000061a (ssd43):
Sep 18 10:07:29 host scsi: [ID 107833 kern.warning] WARNING: /scsi_vhci/ssd@g60060e8004f25e000000f25e00000619 (ssd44):
Sep 18 10:07:29 host scsi: [ID 107833 kern.warning] WARNING: /scsi_vhci/ssd@g60060e8004f25e000000f25e00000618
root@host # more format.out
Searching for disks...done

c6t60060E8004F25E000000F25E000009E1d0: configured with capacity of 25.28GB
c6t60060E8004F25E000000F25E000009E2d0: configured with capacity of 25.28GB
c6t60060E8004F25E000000F25E000009E3d0: configured with capacity of 25.28GB
c6t60060E8004F25E000000F25E000009E4d0: configured with capacity of 25.28GB
c6t60060E8004F25E000000F25E0000061Ad0: configured with capacity of 25.28GB
c6t60060E8004F25E000000F25E0000061Bd0: configured with capacity of 25.28GB
c6t60060E8004F25E000000F25E0000061Cd0: configured with capacity of 25.28GB
c6t60060E8004F25E000000F25E0000061Dd0: configured with capacity of 25.28GB
c6t60060E8004F25E000000F25E0000061Ed0: configured with capacity of 25.28GB
c6t60060E8004F25E000000F25E0000061Fd0: configured with capacity of 25.28GB
c6t60060E8004F25E000000F25E00000618d0: configured with capacity of 25.28GB
c6t60060E8004F25E000000F25E00000619d0: configured with capacity of 25.28GB
c6t60060E8004F25E000000F25E00000620d0: configured with capacity of 25.28GB
c6t60060E8004F25E000000F25E00000621d0: configured with capacity of 25.28GB
c6t60060E8004F25E000000F25E00000622d0: configured with capacity of 25.28GB
c6t60060E8004F25E000000F25E00000623d0: configured with capacity of 25.28GB


AVAILABLE DISK SELECTIONS:
0. c0t0d0
/ssm@0,0/pci@18,600000/pci@2/scsi@2/sd@0,0
1. c1t0d0
/ssm@0,0/pci@1c,600000/pci@2/scsi@2,1/sd@0,0
2. c6t60060E8004F25E000000F25E00000DE8d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e00000de8
3. c6t60060E8004F25E000000F25E00000DE9d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e00000de9
4. c6t60060E8004F25E000000F25E00000DEAd0
/scsi_vhci/ssd@g60060e8004f25e000000f25e00000dea
5. c6t60060E8004F25E000000F25E00000DEBd0
/scsi_vhci/ssd@g60060e8004f25e000000f25e00000deb
6. c6t60060E8004F25E000000F25E00000EA0d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e00000ea0
7. c6t60060E8004F25E000000F25E00000EA1d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e00000ea1
8. c6t60060E8004F25E000000F25E00000EA2d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e00000ea2
9. c6t60060E8004F25E000000F25E00000EA3d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e00000ea3
10. c6t60060E8004F25E000000F25E00000EA4d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e00000ea4
11. c6t60060E8004F25E000000F25E00000EA5d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e00000ea5
12. c6t60060E8004F25E000000F25E00000EA6d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e00000ea6
13. c6t60060E8004F25E000000F25E00000EA7d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e00000ea7
14. c6t60060E8004F25E000000F25E000004A4d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e000004a4
15. c6t60060E8004F25E000000F25E000004A5d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e000004a5
16. c6t60060E8004F25E000000F25E000004A6d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e000004a6
17. c6t60060E8004F25E000000F25E000004A7d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e000004a7
18. c6t60060E8004F25E000000F25E000009E1d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e000009e1
19. c6t60060E8004F25E000000F25E000009E2d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e000009e2
20. c6t60060E8004F25E000000F25E000009E3d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e000009e3
21. c6t60060E8004F25E000000F25E000009E4d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e000009e4
22. c6t60060E8004F25E000000F25E0000037Ad0
/scsi_vhci/ssd@g60060e8004f25e000000f25e0000037a
23. c6t60060E8004F25E000000F25E0000037Bd0
/scsi_vhci/ssd@g60060e8004f25e000000f25e0000037b
24. c6t60060E8004F25E000000F25E0000037Cd0
/scsi_vhci/ssd@g60060e8004f25e000000f25e0000037c
25. c6t60060E8004F25E000000F25E0000037Dd0
/scsi_vhci/ssd@g60060e8004f25e000000f25e0000037d
26. c6t60060E8004F25E000000F25E0000037Ed0
/scsi_vhci/ssd@g60060e8004f25e000000f25e0000037e
27. c6t60060E8004F25E000000F25E0000037Fd0
/scsi_vhci/ssd@g60060e8004f25e000000f25e0000037f
28. c6t60060E8004F25E000000F25E0000061Ad0
/scsi_vhci/ssd@g60060e8004f25e000000f25e0000061a
29. c6t60060E8004F25E000000F25E0000061Bd0
/scsi_vhci/ssd@g60060e8004f25e000000f25e0000061b
30. c6t60060E8004F25E000000F25E0000061Cd0
/scsi_vhci/ssd@g60060e8004f25e000000f25e0000061c
31. c6t60060E8004F25E000000F25E0000061Dd0
/scsi_vhci/ssd@g60060e8004f25e000000f25e0000061d
32. c6t60060E8004F25E000000F25E0000061Ed0
/scsi_vhci/ssd@g60060e8004f25e000000f25e0000061e
33. c6t60060E8004F25E000000F25E0000061Fd0
/scsi_vhci/ssd@g60060e8004f25e000000f25e0000061f
34. c6t60060E8004F25E000000F25E0000097Ad0
/scsi_vhci/ssd@g60060e8004f25e000000f25e0000097a
35. c6t60060E8004F25E000000F25E0000097Bd0
/scsi_vhci/ssd@g60060e8004f25e000000f25e0000097b
36. c6t60060E8004F25E000000F25E0000097Cd0
/scsi_vhci/ssd@g60060e8004f25e000000f25e0000097c
37. c6t60060E8004F25E000000F25E0000097Dd0
/scsi_vhci/ssd@g60060e8004f25e000000f25e0000097d
38. c6t60060E8004F25E000000F25E0000097Ed0
/scsi_vhci/ssd@g60060e8004f25e000000f25e0000097e
39. c6t60060E8004F25E000000F25E00000378d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e00000378
40. c6t60060E8004F25E000000F25E00000379d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e00000379
41. c6t60060E8004F25E000000F25E00000380d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e00000380
42. c6t60060E8004F25E000000F25E00000381d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e00000381
43. c6t60060E8004F25E000000F25E00000382d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e00000382
44. c6t60060E8004F25E000000F25E00000383d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e00000383
45. c6t60060E8004F25E000000F25E00000618d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e00000618
46. c6t60060E8004F25E000000F25E00000619d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e00000619
47. c6t60060E8004F25E000000F25E00000620d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e00000620
48. c6t60060E8004F25E000000F25E00000621d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e00000621
49. c6t60060E8004F25E000000F25E00000622d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e00000622
50. c6t60060E8004F25E000000F25E00000623d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e00000623
51. c6t60060E8004F25E000000F25E00000979d0
/scsi_vhci/ssd@g60060e8004f25e000000f25e00000979
Specify disk (enter its number):
root@host #

No comments:

UNIX: How to print column nicely using printf

[user@hostfwnms1-oam tmp]# cat b.sh printf "%-26s %-19s %-8s %-8s %-s %-s\n" HOSTNAME IP PING SNMPWALK 0-ok 1-fail for i in `cat n...