Subject: Re: [PATCH v4 1/4] Makefile: generate Perl header from template file

From: Junio C Hamano <[email-masked]>
Date: Sat, 02 Dec 2017 21:26:07 -0800

Johannes Sixt <[email-masked]> writes:

>> +	sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
>
> This doesn't work, unfortunately. When $(pathsep) is ';', we get an
> incomplete sed expression because ';' is also a command separator in
> the sed language.

It is correct that ';' can be and does get used in place of LF when
writing a script on a single line, but even then, as part of a
string argument to 's' command (and also others), there is no need
to quote ';' or otherwise treat it any specially, as the commands
know what their syntax is (e.g. 's=string=replacement=' after seeing
the first '=' knows that it needs to find one unquoted '=' to find
the end of the first argument, and another to find the end of the
replacement string, and ';' seen during that scanning would not have
any special meaning).

If your sed is so broken and does not satisfy the above expectation,
t6023 would not work for you, I would gess.

t/t6023-merge-file.sh:sed -e "s/deerit.\$/deerit;/" -e "s/me;\$/me./" < new5.txt > new6.txt
t/t6023-merge-file.sh:sed -e "s/deerit.\$/deerit,/" -e "s/me;\$/me,/" < new5.txt > new7.txt
t/t6023-merge-file.sh:sed -e 's/deerit./&%%%%/' -e "s/locavit,/locavit;/"< new6.txt | tr '%' '\012' > new8.txt