[comp.mail.mush] picking and sorting

duanev@kauai.ACA.MCC.COM (Duane Voth) (03/03/90)

I've been trying to pick and sort messages (letters? articles?)
in a folder but I keep getting this:

	Range not broad enough to sort anything

my command is:

	pick -t <pattern> | sort a

pick -t <pattern> by itself finds about 30 out of 94 messages.
sort with 's' and 'd' do the same thing.  what am I missing?



also, is there a way to "partition" the current folder so that
all unread messages can be kept in the same file but with all
messages addressed to a common place in one partition, messages
to another address in another partition, and remaining messages
in a third?  a blank line or an empty message would make a
reasonable partition divider which would then reduce this request
to a complicated sorting problem.  any ides?

(I'm running (6.5 4/17/89) [5/12/89])

duane
-- 
--- duane voth                                         duanev@mcc.com
----    {uunet,harvard,gatech,pyramid}!cs.utexas.edu!milano!pp!duanev
--- ALL systems are arbitrary!  Effectiveness is the measure of Truth
--

schaefer@ogicse.ogi.edu (Barton E. Schaefer) (03/03/90)

In article <619@kauai.ACA.MCC.COM> duanev@kauai.ACA.MCC.COM (Duane Voth) writes:
} I've been trying to pick and sort messages (letters? articles?)
} in a folder but I keep getting this:
} 	Range not broad enough to sort anything
} my command is:
} 	pick -t <pattern> | sort a
} pick -t <pattern> by itself finds about 30 out of 94 messages.
} sort with 's' and 'd' do the same thing.  what am I missing?

What you are missing is that the messages to be sorted must be in a
contiguous block, that is, their numbers must be consecutive.  So you
can sort 1-5, or 3-12, or 7-17, but not 1,3,5-7,12,17.  You can only
pipe "pick" into "sort" if you have pre-sorted on the same field you
will be selecting with pick.

Since there isn't any option to sort on the "To" field, "pick -t" is
most likely NOT returning a consecutive list, so sort gets upset.

The closest you can come with only pick and sort is

    sort a ; pick -t <pattern>

which sorts ALL messages by author and then returns the ones "to" whoever
in the right order.

However,there were some "cut" and "paste" cmds posted here a while back.
The idea is to use "save" (followed by possible delete/update) to cut and
"merge" to paste.  So:

    pick -t <pattern> | save pick.file | delete
    update	# optional
    merge pick.file | sort a
    sh rm pick.file

} also, is there a way to "partition" the current folder

Not really.  You can bundle all the related messages into a digest and
use "undigest" to unpack them when you want to look at them separately.
There isn't any good way to build the digest except to save all the
messages into a file, change all the "From " (no colon) lines to ">From "
and add a line with 8 hyphens (--------) above each >From.  I could try
to explain how to do this from automatically from mush, but it's tricky.

Maybe digest-building would be a good thing for mush to support ...

At some point mush will support cut/paste and multiple open folders,
which could be used to implement your partitioning.  But not yet; at
least not in the next release ...
-- 
Bart Schaefer          "February.  The hangnail on the big toe of the year."
                                                                    -- Duffy

schaefer@cse.ogi.edu (used to be cse.ogc.edu)

duanev@kauai.ACA.MCC.COM (Duane Voth) (03/06/90)

In article <7682@ogicse.ogi.edu>, schaefer@ogicse.ogi.edu (Barton E. Schaefer) writes:
> In article <619@kauai.ACA.MCC.COM> duanev@kauai.ACA.MCC.COM (Duane Voth) writes:
> } ... is there a way to "partition" the current folder
> 
> [digest idea...] [future cut/paste idea...]

Actually, I've found something I can live with that works fairly well.
I've created several bogus mail articles of the form:

	From ----[gwm-]-------------------- Sun Jan 1 00:00:00 1900
	To: gwm-bugs@mirsa.inria.fr
	Subject: ----[gwm-]-----------------------------
	Date: Sun Jan 1 00:00:00 1900
	Status: OR

	separator article

where [gwm-] is the title of my "partition", and a cmd of the form:

	collect 'pick -t !* | copy ! mail.trash | delete; update;
	         merge mail.tras h; sh rm mail.trash'

Now, when I say "collect gwm-*", all articles recieved by me on the
gwm-* mailing lists get placed at the end of the folder with the
separator article preceeding them.  It's aesthetically appealing
and fairly easy to use!

Possible improvements are: a) a shell script (?) that can detect my
seperator articles and do a "collect" on each thus eliminating my
argument to collect and making it a "sort the whole folder" command.
b) some way to merge at the beginning of the folder instead of the end
(so that ungrouped articles are all at the end of the folder where new
articles appear).  Any ideas here?

One last thing, sort d couldn't correctly sort dates with years above 1999
(I tried putting the separator at the end of a partition to start with).
I'm using (6.5 4/17/89) [5/12/89].  Is sort looking only at the last two
digits of dates?


-- 
--- duane voth                                         duanev@mcc.com
----    {uunet,harvard,gatech,pyramid}!cs.utexas.edu!milano!pp!duanev
--- ALL systems are arbitrary!  Effectiveness is the measure of Truth
--

schaefer@ogicse.ogi.edu (Barton E. Schaefer) (03/06/90)

In article <639@kauai.ACA.MCC.COM> duanev@kauai.ACA.MCC.COM (Duane Voth) writes:
} In article <7682@ogicse.ogi.edu>, schaefer@ogicse.ogi.edu (Barton E. Schaefer) writes:
} > In article <619@kauai.ACA.MCC.COM> duanev@kauai.ACA.MCC.COM (Duane Voth) writes:
} > } ... is there a way to "partition" the current folder
} > 
} > [digest idea...] [future cut/paste idea...]
} 
} Actually, I've found something I can live with that works fairly well.
[Description of separator article deleted]
} 
[I presume this should be preceded by the keyword "cmd":]
} 	collect 'pick -t !* | copy ! mail.trash | delete; update;
} 	         merge mail.trash; sh rm mail.trash'
                               ^^ there was a space there, I deleted it
} 
} Now, when I say "collect gwm-*", all articles recieved by me on the
                           ^^^^^ I bet you mean "gwm-.*" (regex syntax)
} gwm-* mailing lists get placed at the end of the folder with the
} separator article preceeding them.  It's aesthetically appealing
} and fairly easy to use!

This is essentially the same thing that happens when you do "undigest",
if you substitute the digest article itself for the separator article
and the messages burst from the digest for the other messages in the
partition created by this "collect" cmd.

} Possible improvements are: a) a shell script (?) that can detect my
} seperator articles and do a "collect" on each thus eliminating my
} argument to collect and making it a "sort the whole folder" command.

This isn't hard.  (I presume that by "shell script (?)" you mean a mush
script.)  The main drawback is that !* isn't expanded in scripts.  So
you'd have to change it to

    cmd collect 'pick -t $to ....'

and then use

    set to='gwm-.*'
    collect
    set to='next mailing list pattern, whatever that is'
    collect
    etc.

(Eventually mush may have a looping construct for this kind of thing.)

} b) some way to merge at the beginning of the folder instead of the end
} (so that ungrouped articles are all at the end of the folder where new
} articles appear).  Any ideas here?

Sure.  You do

    pick -r * -s --gwm----- | from -	# move to first separator article
    copy ! 1-. {.} mail.trash | delete	# copy+delete everything above it
    update; merge mail.trash		# and pull it in
    sh rm -f mail.trash

} One last thing, sort d couldn't correctly sort dates with years above 1999

This will be handled correctly in 7.1 -- along with time zones.  It has
the usual signed-long-integer-seconds-since-1970 limitation of around
2038, but that should suffice for a while at least. :-)

} Is sort looking only at the last two digits of dates?

You guessed it ... actually, mush is only *storing* the last two digits
of the date; sort would handle it right if it had the rest of the info.
-- 
Bart Schaefer          "EARTH: Surrender IMMEDIATELY or we PICKLE DAN QUAYLE"

                                                                    "THPPFT!"
schaefer@cse.ogi.edu (used to be cse.ogc.edu)