In my case it was from MPEG2 Transport Streams and I wanted to copy out some data from deep within a massive multi gigabyte file.
extract is a simple bash script that calls DD and copies out bytes from the middle of the file.
#!/bin/bash
if [ 4 -ne $# ]; then
echo
echo "Usage: extract [infile] [outfile] [start] [len]"
echo
echo "extract will copy len bytes from start post from infile to outfile"
echo
exit
fi
IFILE=$1
OFILE=$2
FSTART=$3
FLEN=$4
dd bs=1 if=$IFILE of=$OFILE seek=0 skip=$FSTART count=$FLEN
if [ 4 -ne $# ]; then
echo
echo "Usage: extract [infile] [outfile] [start] [len]"
echo
echo "extract will copy len bytes from start post from infile to outfile"
echo
exit
fi
IFILE=$1
OFILE=$2
FSTART=$3
FLEN=$4
dd bs=1 if=$IFILE of=$OFILE seek=0 skip=$FSTART count=$FLEN
No comments:
Post a Comment