Automate Datastore creation with grep, awk, or sed

This post was originally published on this site

I am updating my post kickstart to layout my ESX datastore.  This is for my lab environment where I wipe and drop often. I got all of my drives type and label in a simple array




What is the proper syntax or tool (grep, sed, or awk) to read in for example “SATA_SSD-SSD_VM” as $input and break it up into two variable where the market is “-”

So $type = would be “SATA” or all character from the start of $input up to the character “-“


and $label = would be “SSD_VM” or all the character after “-” to the end of the $input string


And feedback would be appreciated.  Thank you in advance

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.