$ chmod a+x matts_split.sh
$ ./matts_split.sh path/to/blob_file.baz path/to/tab_separated_offsets.tab
Created
January 17, 2012 17:49
-
-
Save jrunning/1627806 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env sh | |
| # Change this to what you want the output files to be named (don't remove | |
| # the %04s part--it adds the number to each filename). | |
| out_file_name="out_file_%04s.baz" | |
| count=0 | |
| while read offset image_size | |
| do | |
| count=$((count + 1)) | |
| # NOTE: To see what commands will be run without actually running | |
| # them put "echo " before the line below, e.g. "echo dd if=$1 ...". | |
| dd if=$1 of=$(printf $out_file_name $count) ibs=1 skip=$offset count=$image_size | |
| done < $2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 0 179546 | |
| 179546 180260 | |
| 359806 181070 | |
| 540876 182138 | |
| 723014 182616 | |
| 905630 183266 | |
| 1088896 183740 | |
| ... ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment