aboutsummaryrefslogtreecommitdiff
path: root/dump_sector.sh
blob: fdcf2d0601a6460e04a1ae02c0bb33397483038a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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