home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
551.lha
/
Chop_v0.92
/
chop.doc
< prev
next >
Wrap
Text File
|
1991-09-08
|
3KB
|
90 lines
Chop v0.92 by Terry Brown, 1990,1991
Chops up files into smaller parts, in a variety of ways.
Briefly -
Chop filename [-sn] [-bn] [-cn] [-Bs|-As] [-in] [-Ps] [-p]
-sn skip first n bytes, start from start if omitted
-bn take only n byte chunks, take remainder of file if omitted
-cn take only n chunks, take chunks to end of file if omitted
-Bs after taking -bn bytes, take bytes until string s is reached
-As after taking -bn bytes, take bytes until end of string s is reached
-in buffer size n kilobytes, default 40, needs two of them
-Ps string s is path and file name for output
-p prompt before writing each file
s must contain no spaces, ? matches anything, and `hh is a hex constant
watch for shells which pre-expand wild cards etc.
Eg. Chop dh0:bigText -b10000 -B`0A`20 -Pdf0:textBit -p
breaks bigText into roughly 10000 byte pieces before lines starting with a
space, saving them to df0:textBit.001, df0:textBit.002 etc., and giving you
a chance to change disks before each write.
(`0A`20 is hex for newline + space)
This program will drop the first n bytes of a file, cut a file into n byte
chunks, or n byte chunks plus enough bytes to get to the next end of line or
header, useful if your chopping up text files. And you can save to another
device, with pauses to change floppies if you're moving a larger than one
floppy file etc. It acheives reasonable speed by doing large reads and
writes. Generally really useful.
This program very closely resembles Chop 3.1 for MSDOS, but believe it or
not it was written before I saw the MSDOS version. I guess the features for
this sort of thing are fairly obvious :-).
If you think the source is rough now, you should have seen it before it was
tidied up :-). It may occasionally produce a zero length file, but not very
often. Also, if it runs out of buffered data while testing one of the
search strings, it may say 'Out of range search for end of target', this may
mean a file will not be split where it should of been, but will be very
rare. (In fact I don't think it can happen at all since I decided not to
implement the multi-character wildcard bit). If it says this, it probably
just means it reached the end of file while testing a search string.
A few examples...
chop dh0:downloads/BBS.cap -b1 -B`0AFrom -Pdh0:msgs/Msg
would take a list of messages captured from a BBS in the file BBS.cap and
place the separate messages in dh0:msgs/ as Msg.1, Msg.2 etc., assuming each
message had From at the start of a new line at the beginning.
...well alright, just one example :-)
Bug reports, comments etc. etc. to
tb@tbnode.equinox.gen.nz or brownt1@lincoln.ac.nz
--- boring bits ---------------------------------------------------------
Chop is freely redistributable, but may not be sold for profit (ha ha). I
take no responsibility for any damage resulting from its use, use it at your
own risk. Where trade marks occur in this document, they are trade marks of
the companies owning them.
--- revision history ----------------------------------------------------
0.92
* added preceeding zeroes to extensions in chopped bits (useful for joining
with csh etc.)
* stopped zero length files being created
0.91
* fixed typo in help text
* added code to avoid crash when output file won't open
* checked for CHR(10)'s in parameters, as added by csh
0.90
* added all features :-)