[texworks] Feature/enhancement request
Duncan Murdoch
murdoch.duncan at gmail.com
Sun May 1 20:08:23 CEST 2022
On 01/05/2022 1:49 p.m., Philip Taylor (Hellenic Institute) wrote:
> On 01/05/2022 18:30, Philip Taylor (Hellenic Institute) wrote:
>>
>> OK, many thanks for the suggestion. I shall give it some thought.
>>
> It looks as if CMD's FOR command plus ECHO might be what is needed.
> Something along the lines of
I'm not familiar with the details of CMD's scripting, but the thing I'd
worry about is that if it drops blank lines, it might make other
undesirable changes as well. If I was using CMD, I'd probably look for
a program like "sed" that was designed for editing. sed itself is
available for Windows; the command to echo all but the first line of
input would be
sed -e 1d < bowls-rr.ta68
or if I wanted to delete all the lines (if any) with % at the start,
sed -e /^%/d < bowls-rr.ta68
This could be included in a larger .cmd script that went on to run the
compiler.
Duncan Murdoch
>
>> FOR /F "skip=1 tokens=1* " %i in (bowls-rr.ta68) do @echo %i %j
> which yields (for a noddy program with a leading pragmat)
>
>> BEGIN
>> # ================================================================
>> This program attempts to find one or more solutions to scheduling a
>> multiple round-robin bowls tournament
>> ================================================================ #
>> INT number of teams, number of rinks, number of dates;
>> print ("Number of teams: "); read (number of teams);
>> INT number of matches = number of teams ^ 2 - number of teams;
>> print (("Each round will require ", number of matches, " matches.",
>> newline ));
>> print ("Number of rinks: "); read (number of rinks);
>> INT number of days = number of matches OVER 4;
>> print (("Number of days required for one round: " , number of days,
>> newline));
>> print ("Number of dates: "); read (number of dates);
>> INT number of rounds = number of dates OVER number of days;
>> print (("With the constraints given, there can be a maximum of ",
>> number of rounds, " rounds", newline))
>> END
> It has dropped the blank lines in the original, but the remainder
> appears as typed, /sans/ leading pragmat.
>
> --
> /** Phil./
>
More information about the texworks
mailing list.