i'd like to parse the ouput in shell
i'd like to parse the ouput of
sfdisk -s
This would give me something like:
/dev/sda: 10485760
total: 10485760
Since I'm pxe booting a limited shell, i'll have grep and mawk at my disposal. I'm not sure what else I would need since I don't know what is available in this shell until i try it.
I basically want to take the "sda" out of the line "/dev/sda: 10485760" and assign "sda" to a variable that I can use throughout the /bin/sh program.
We'll assume we only have one type of drive per system which means it will be either sda, hda, cciss, etc....
How can I do this?
Some background info: I'm trying to customize a systemimager script to recognize the drive automatically...so whether it is scsi, hp scsi device, sata, pata...i want to be able to automaticaly recognize what device to use in order to create the partitions, fstab file, and boot loader config file in the script. This comes in hand when having 1 OS being installed onto different hardware.
|