Re: Split the FAQ?

---------

Kent Landfield (Kent_Landfield@sterling.com)
Thu, 21 Jul 94 18:20:46 CDT


>
> Hi,
>
> Is there a nice tool that will let me split an FAQ into parts
> for mailing. I don't need a tool that will make it look nice,
> I just want a tool, which, given a number between 1 and 10 can
> split a text file into that many small parts.
>

You mean something like this ? This is real cheesy with no error checking
to speak of but it is easy to hack in... :-)

-------------------------------
#!/bin/sh
USAGE="$0 filename #parts"

case $# in
2) ;;
*) echo $USAGE; exit 1;;
esac

#
# size the file
#
lines=`wc -l $1 | awk '{ print $1 }'`
numlines=`expr $lines / $2`

#
# Alert the user.
#
echo $1 being split in to $2 parts with $numlines lines each

#
# doit leaving the split files in $1aa, $1ab ...
#

split -$numlines $1 $1

ls -l $1*

-------------------------------

-Kent+

-- 
Kent Landfield                        INTERNET: kent_landfield@sterling.com
Sterling Software                     UUCP:     uunet!kent || sparky!kent
Phone: (402) 291-8300                 FAX:     (402) 291-4362
Please send comp.sources.misc-related mail to kent@uunet.uu.net.


[ Usenet Hypertext FAQ Archive | Search Mail Archive | Authors | Usenet ]
[ 1993 | 1994 | 1995 | 1996 | 1997 ]

---------

faq-admin@landfield.com

© Copyright The Landfield Group, 1997
All rights reserved