File Splitting
plug@arcticmail.com
plug@arcticmail.com
Tue, 5 Dec 2000 21:24:51 -0700
What??? Everyone DOESN'T instinctively
think to do
sed -n '1,99p' < infil >foo.01
sed -n '100,199p' < infil >foo.02
sed -n '200,299p' < infil >foo.03
sed -n '300,399p' < infil >foo.04
sed -n '400,499p' < infil >foo.05
???
FWIW, split (at least my flavor) has
a "-l" option to split a file based on
line count instead of byte count.
Never tried it on a Mac file, tho.....
D
* On Tue, Dec 05, 2000 at 08:00:58AM -0700, sinck@ugive.com wrote:
>
>
> \_ Can you help me out?
> Which way did you come in? :-)
>
> \_ How are you splitting your files, I am in need of away to take a large plain
> \_ text database report and break it up into small pieces.
>
> In this case, split isn't your friend, since it doesn't care about
> line breaks, which, presumably your plain text database does.
>
> Try successive runs of tail and head, or the following perl script
>
> #!/usr/bin/perl
>
> # invoke: thisfile.pl file_to_split
>
> # YMMV
>
> $lines = 100; # how many lines/file
> $outfile = "xaa"; # base
>
> open (F, "> $outfile"); # initial
> while (<>)
> {
> print F;
> if (! ($. % $lines))
> {
> close (F);
> $outfile++; # perl magic
> open (F, "> $outfile");
> }
> }
> close(F);
>
>
> # David
>
> ________________________________________________
> See http://PLUG.phoenix.az.us/navigator-mail.shtml if your mail doesn't post to the list quickly and you use Netscape to write mail.
>
> Plug-discuss mailing list - Plug-discuss@lists.PLUG.phoenix.az.us
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>