On Wed, 16 Jul 2003, BSD baby wrote: > Is there an easy built-in way to copy only part of a file? > > I want to take a WAV audio file and copy from #__ bytes to > #___ bytes into a new file. > > (I'm making 30-second clips of files.)
Try "dd". Thus: dd bs=1 skip=$offset count=$length < infile > outfile It is possible that a block size of one byte is kind of inefficient, so if you can operate in units of some larger size that might be good. For example "bs=1k". See "man dd". Also, remember that WAV files have a 44 byte (or was that 42...?) wav header. Yes, you can extract it with "dd bs=44 count=1", but I'm too lazy to find out whether you can just prepend it to any split files right now (i.e. if the file contains any length info; I suspect not). > Though I found a scripting way to do it with PHP, I'm wondering > if there's a more direct way to do it with basic GNU/BSD commands. Ever heard of POSIX... ;-) $.02, /Mikko _______________________________________________ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"