🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #5700

Re: NNTPSEND pre-sort patch (UNOFF4)

#5700
From: Rahul Dhesi
Date: Sat, 16 Mar 1996 00:00
51 lines
2012 bytes
I normally do a 'batched sort', as that lets you maintain some idea of
chronological order and do FIFO truncation of long batch files.  Below
is my 'bsort' perl script.  Just plug it in anywhere you would pipe
through 'sort'.

== begin perl code ==
#! /local/bin/perl
# Sort input, or argument file(s), in $LIMIT-line pieces.

# This is useful when processing batches of outgoing News.  Sorting
# filenames makes directory access more efficient.

# Also useful to speed up commands like
#   find . -type f -mtime +3 -print | bsort | xargs rm -f
# when cleaning up filled News spools.

# At the same time, too much sorting causes loss of information about
# the order in which articles were queued, making it harder to shorten
# a very long batch file by skipping the older articles.

# Compromise:  sort in $LIMIT-line pieces.  Default is below, but
# may be overridden with a command-line arg, e.g., 
# 'bsort 10000' to sort in 1000-line pieces.

# Rahul Dhesi <dhesi@rahul.net>
# hostmaster & postmaster
# a2i communications network operations

$LIMIT = shift || 2000;

$count = 0;
while (<>) {
   push(@list, $_);
   if ($count++ > $LIMIT) {
      @out = sort @list;
      @list= ();
      print @out;
      $count = 0;
   }
}

if (@list > 0) {
   @out = sort @list;
   print @out;
}
== end perl code ==
-- 
Rahul Dhesi <dhesi@rahul.net>
"please ignore Dhesi" -- Mark Crispin <mrc@CAC.Washington.EDU>

Technical Details
Message-ID: <4id788$gj3@hustle.rahul.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
References: <4ib76t$gqb@news.ims.mariposa.ca.us>

Show Full Headers
Complete Article Headers
Message-ID: <4id788$gj3@hustle.rahul.net>
Subject: Re: NNTPSEND pre-sort patch (UNOFF4)
Date: Sat, 16 Mar 1996 00:00:00 +0000
From: Rahul Dhesi <dhesi@rahul.net>
References: <4ib76t$gqb@news.ims.mariposa.ca.us>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 142868975
Organization: a2i network
Nntp-posting-user: dhesi
Newsgroups: news.software.nntp