There are lots of ways to process text files (eg sed, awk, etc); I'm after suggestions on the best/easiest way to achieve something fairly trivial to describe.
Below is example output from sfdisk -d:
label: dos label-id: 0xe3f4f21a device: /dev/sdd unit: sectors
/dev/sdd1 : start= 8192, size= 85622, type=c /dev/sdd2 : start= 94208, size= 5521408, type=83 /dev/sdd3 : start= 5615616, size= 25499648, type=83
I want to convert this into a new script to go back into sfdisk but with some changes; I want the start values skipped (so sfdisk will put partition boundaries wherever it thinks is best), I want the last sector not have a size (ie "rest of disk"), and I don't really need any of the settings at the top.
In fact, a suitable (minimal) script to go into sfdisk would be simply: ,85622,c ,5521408 ,;
I don't really mind at this point whether I end up with something more like the first format or minified like the latter. In fact to be honest I'm more interested just in learning the best ways to play with text files like this.