#!/u/jc0/aix/bin/perl # # Read all the files in the fortunes directory and catenate # them into one big file, with double blank lines (i.e., # "\n\n\n") as separators. $M = 100; open(F,"find fortune -type f -print |") || die "Can't run \"find fortune\" [$!]\n"; open(L,">fortunes") || die "Can't write \"fortunes\" [$!]\n"; select L; $| = 1; select STDOUT; $| = 1; for $f () { print "$f\n"; if (open(X,"<$f")) { for $l () { while (length($l) > $M) { $i = substr($l,0,$M); substr($l,0,$M) = ''; print L "$i\n"; } if (length($l) > 0) { print L $l; } } print L "\n\n"; } else { print "Can't read \"$f\" [$!]\n"; } }