nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [nmh-workers] Ordinal Indicators.


From: Ralph Corderoy
Subject: Re: [nmh-workers] Ordinal Indicators.
Date: Mon, 08 Jul 2019 13:08:49 +0100

Hi kre,

>       D=$(date +%d)
>       case "$D" in
>       [023]1) ORD=st;;
>       [02]2)  ORD=nd;;
>       [02]3)  ORD=rd;;
>       *)      ORD=th;;
>       esac
>       case "$D" in
>       0*)     SP=;;
>       *)      SP=' ';;
>       esac

I ended up with

    $ cat ~/bin/ordsuff
    #! /bin/sed -rf

    # Append an ordinal indicator to the number on each line.

    s/1$/&st/
    s/2$/&nd/
    s/3$/&rd/
    s/[4-9]$/&th/
    s/.0$/&th/

    /1(1st|2nd|3rd)$/s/..$/th/
    $ 

> ps: this is not really an nmh-workers issue!

This is true.  To correct that, I note mh-format(5) too has no function
to produce the ordinal suffix.  :-)

-- 
Cheers, Ralph.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]