On Wed, Oct 14, 2020 at 9:52 AM Philippe Blain <levraiphilippeblain@xxxxxxxxx> wrote: > > Le 14 oct. 2020 à 09:45, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> a écrit : > >>> Le 12 oct. 2020 à 18:47, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> a écrit : > >>> create_crlf_ref () { > >>> branch=$1 > >>> cat >.crlf-message-$branch.txt && > >>> sed -n "1,/^$/p" <.crlf-message-$branch.txt | sed "/^$/d" | append_cr >.crlf-subject-$branch.txt && > >>> sed -n "/^$/,\$p" <.crlf-message-$branch.txt | sed "1d" | append_cr >.crlf-body-$branch.txt && > > > > The code I proposed is very explicit about using CRLF terminators. The > > here-doc fed to create_crlf_ref() contains only the normal LF, but > > then create_crlf_ref() explicitly converts those to CRLF by calling > > append_cr(). > > Sorry, I missed that. I'll try to see if I can make it simpler using > this approach then. By the way, if you also need .crlf-message-$branch.txt to have CRLF line endings, then you'll probably want to use a temporary file (for instance, .crlf-orig-$branch.txt), perhaps like this: create_crlf_ref () { branch=$1 && cat >.crlf-orig-$branch.txt && append_cr <.crlf-orig-$branch.txt >.crlf-message-$branch.txt && sed -n "1,/^$/p" <.crlf-orig-$branch.txt | sed "/^$/d" | append_cr >.crlf-subject-$branch.txt && sed -n "/^$/,\$p" <.crlf-orig-$branch.txt | sed "1d" | append_cr >.crlf-body-$branch.txt && ... }