[Remind-Fans] Sorting the reminders file

Jostein Berntsen jbernts at broadpark.no
Fri Sep 17 11:11:23 EDT 2010


On 16.09.10,08:10, David F. Skoll wrote:
> Jostein Berntsen wrote:
> 
> > Has anyone found a script or another way to sort the reminders file, so 
> > that all entries are sorted by date with the most recent at the end of 
> > the file?
> 
> No, because except in the most simple cases, there's no defined sort
> order for REM statements.  For example, which comes first:
> 
> REM [complex_function()] Tue OMIT Sat Sun MSG foo
> REM Tue SATISFY [complex_function_2()] MSG bar
> 

A possible solution I tried out on the command line is this:

sed -e '/^REM/s/\(.* .* \)\([0-9]\)\( .*\)/\10\2\3/g' ~/.reminders  |  \
awk 'NR > 20' | sort -n -k 4.4 -k 4.3 -k 3.1 -k 6.1 | sort -k2M | sed  \
'/./!d' 


Assumes date entries as "22 Sep 2010" and LC_ALL=C. All special 
functions and calls are at the top of the file.


Jostein




More information about the Remind-fans mailing list