This is a snippet of code used in the FOGProject to resize partitions from sfdisk -d data. This repository exists with the purpose of experimenting, testing, and ultimately separating the awk code from bash.
Why do this? Mixing awk and bash at this scale is difficult to read and understand. Just look at bash-test.sh. It is not in a friendly format, contains excessive newline slashes, and does not feature comments.
The file bash-test.sh is a snippet of code that represents the original form of the awk script.
The file procsfdisk.awk is the work in progress for reworking bash-test.sh as a seperate script that is purely awk.
An example.data file can be generated by running sfdisk -d example.data on a linux host.
One of the example test comparisons follows:
./bash-test.sh example.data resize /dev/sda1 100000
./procsfdisk.awk -v p0=resize -v p1=/dev/sda1 -v p2=100000 example.data