groff
[Top][All Lists]
Advanced

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

[groff] Changing A Defined String


From: Robert Thorsby
Subject: [groff] Changing A Defined String
Date: Thu, 25 Jan 2018 15:03:24 +1100

Temperatures here in AU have been in the range 35-45 for the past week and are forecast to be the same for the next week. So with no inclination towards serious work I have turned my attention to rewriting my letterhead shell script, as one does.

My letters carry the date in full -- Thursday, 25 January 2018 -- which is placed into the preamble of the groff file via my shell script:

date --date="..." "+.ds DATE*FULL %A, %-d %B %Y" >> draftletter.gr

But occasionally I also want to use the date in a ``shorter'' version that depends on the ``full'' version. I appreciate that I can simply create two definitions, but once defined they would be independent of each other.

.ds DATE*FULL Thursday, 25 January 2018\"  from the shell script
.ds DATE*SHORT 25 January 2018\"           from the shell script
[each can be subsequently edited without reference to the other]

What I'm after is something like:
.ds DATE*FULL Thursday, 25 January 2018\"  from the shell script
.ds DATE*SHORT \*[DATE*FULL]\" static entry in groff file DATE*SHORT="$(sed 's/.*, //' <<< "$DATE*FULL")" static entry in groff file

Can anyone assist with proper groff request(s) to replace the bashism so that any amendment to DATE*FULL is carried through automagically to DATE*SHORT? I don't use any macro package.

TIA,
Robert


reply via email to

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