I am trying to determine the Startsector of a .img file from within a bash script so it can be correctly mounted from within the script. I have been using the file command to easily find the Startsector - how ever I'm not sure how to extract that number from the output. I think the answer lies with using awk but I cannot for the life of me fathom out how to do it.
Here is the output of the file command for reference:
kemra102@kaon:~/Downloads$ file 2012-07-15-wheezy-raspbian.img
2012-07-15-wheezy-raspbian.img: x86 boot sector; partition 1: ID=0xc, starthead 130, startsector 8192, 114688 sectors; partition 2: ID=0x83, starthead 165, startsector 122880, 3665920 sectors, code offset 0xb8
kemra102@kaon:~/Downloads$