aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2020-05-12 04:38:30 -0400
committerB. Watson <yalhcru@gmail.com>2020-05-12 04:38:30 -0400
commitb7a888a6f8d1ac61af97fd4b33a75d957cf2c99c (patch)
tree16960a161f7ac3d958ca9ec3acd4a199f5f05adf
parent39bde831071ed7e54350d609c648afae2dec206b (diff)
downloadmiragextract-b7a888a6f8d1ac61af97fd4b33a75d957cf2c99c.tar.gz
add utility script dump_sector.sh
-rwxr-xr-xdump_sector.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/dump_sector.sh b/dump_sector.sh
new file mode 100755
index 0000000..fdcf2d0
--- /dev/null
+++ b/dump_sector.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# dump a sector(s) from a raw dump (2352 byte sectors) or 'cooked' data
+# track (2048 byte sectors).
+
+if [ "$1" = "" -o "$1" = "--help" ]; then
+ cat <<EOF
+Usage: $( basename $0 ) [-i] filename sector [sector_count]
+-i is "ISO mode", 2048 byte sectors.
+EOF
+ exit 0
+fi
+
+secsize=2352
+if [ "$1" = "-i" ]; then
+ secsize=2048
+ shift
+fi
+
+filename="$1"
+
+sector="$2"
+count="${3:-1}"
+
+dd if="$filename" bs="$secsize" skip="$sector" count="$count" | xxd | less