nmh-workers
[Top] [All Lists]

Re: [nmh-workers] Ordinal Indicators.

2019-07-08 07:09:18
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.

-- 
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>