Re: file splitter and merger??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 29, 2007 at 10:35:32AM +1100, Lux Zhang wrote:
> what are tools to split a large file (etc 700mb a.avi) into small
> pieces and then the merger to merge them?

People have suggested 'split' and 'cat'.  These are at best marginal, at
worst simply won't work for binary files.

Look for a script called 'bsplit'.  If you can't find a distributed version,
something like the attached will work.

Cheers,
--
	Dave Ihnat
	President, DMINET Consulting, Inc.
	dihnat@xxxxxxxxxx
#
# bsplit [n] name
#
# Breaks a file into N-block parts, where a block is 512 bytes
#
# Author: Dave Ihnat.  Released as a work in the Public Domain.

BCOUNT=0
FCOUNT=0
BSKIP=0

if [ $# -eq 2 ]
then
	BCOUNT=$1;
	shift;
else
	BCOUNT=100;
fi;

OUTFILE=$1;
PREFIX=00

while [ TRUE ]
do
	echo "$OUTFILE.${PREFIX}${FCOUNT}"

#	dd of=$OUTFILE.${PREFIX}${FCOUNT} skip=$BSKIP count=$BCOUNT
	dd of=$OUTFILE.${PREFIX}${FCOUNT} count=$BCOUNT

	if [ $? -ne 0 ]
	then
		break;
	fi;

	if [ ! -s $OUTFILE.${PREFIX}${FCOUNT} ]
	then
		rm $OUTFILE.${PREFIX}${FCOUNT}
		break;
	fi;

	FCOUNT=`expr $FCOUNT + 1`
	if [ "$FCOUNT" -gt 99 ]
	then
		PREFIX=""
	elif [ "$FCOUNT" -gt 9 ]
	then
		PREFIX="0"
	fi;

	BSKIP=`expr $BSKIP + $BCOUNT`
done

exit 0
-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux