|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: R T
Length: 1684 (0x694)
Types: TextFile
Names: »README«
└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
└─⟦this⟧ »EUUGD11/euug-87hel/sec1/slice/README«
Slice splits up a file into lots of little files. It reads its input a
line at a time, and starts a new output file when
* the input line matches a pattern, or
* there have been n lines written to the current output file.
You can use it to split a mailbox or an archive of news articles into
one article per file, for example. In fact, you can do this with about
5 lines of awk, but you run into problems with long lines (and speed,
if it bothers you!).
Slice was originally contributed by Russell Quinn as the program
"mailsplit". Unlike mailsplit, however, slice allows multiple output
formats to be specified (rather than multiple input files). This makes
it possible to deposit the pieces (slices!) into files named whatever
your want. For example:
slice <article -x '^--* [Cc]ut' README article.sh
will deposit everything up to the cut line into README and everything
after it into article.sh (the -x option causes the matched line to be
excluded).
There are even options to make slicing mailboxes and files containing
shell scripts easier (-m and -s).
There are some good examples in the man page.
Source, Makefile and manual entry enclosed. To install, do the
following:
1: Edit the Makefile: you'll need to alter the "R=/usr/local" if
you don't want slice to live in /usr/local/usr/bin.
2: make slice
3: have a play with it & satisfy yourself that it behaves reasonably
4: make install
Make "install" will do a "$(MAKE) $(CLEAN)" afterwards. If you don't
want to remove the binary, say
CLEAN="" make install
at step 4.
Gary Puckering 3755 Riverside Dr.
Cognos Incorporated Ottawa, Ontario
(613) 738-1440 CANADA K1G 3N3