From: Johannes Sixt <j6t@kdbg.org>
To: Marco Stornelli <marco.stornelli@gmail.com>
Cc: git@vger.kernel.org, gitster@pobox.com
Subject: Re: [PATCH v4] Thunderbird: fix appp.sh format problems
Date: Fri, 31 Aug 2012 23:35:41 +0200 [thread overview]
Message-ID: <50412E2D.7070503@kdbg.org> (raw)
In-Reply-To: <5040C59A.6090303@gmail.com>
Am 31.08.2012 16:09, schrieb Marco Stornelli:
> +CCS=`perl -e 'local $/=undef; open FILE, $ENV{'PATCHTMP'}; $text=<FILE>;
> +close FILE; $addr = $1 if $text =~ /Cc: (.*?(,\n .*?)*)\n/s; $addr =~ s/\n//g;
> +print $addr;'`
The quoting is broken in this line (sq within sq does not work).
Am I correct that you intend to treat continuation lines with this
non-trivial perl script? All this processing gets tedious and
unreadable. Let me suggest this pattern instead:
# translate to Thunderbird language
LANG_TO="To:"
LANG_SUBJ="Subject:"
LANG_CC="Cc:"
LF= # terminates the _previous_ line
while read -r line
do
case $line in
'To: '*)
printf "${LF}%s" "$LANG_TO ${line#To: }"
;;
'Cc: '*) ...similar...
'Subject: '*) ...similar...
' '*) # continuation line
printf "%s" "$line"
;;
'')
print "${LF}\n"
cat
;;
esac
LF='\n'
done <"$PATCH" >"$1"
Instead of printing right away, you can also accumulate the data in
variables and print them right before the 'cat'. I would do that only if
a particular order of To:, Cc:, and Subject: is required in the output.
(I don't know how the "do not delete this line" line fits in the
picture, but I'm sure you can figure it out.)
-- Hannes
next prev parent reply other threads:[~2012-08-31 21:35 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-31 14:09 [PATCH v4] Thunderbird: fix appp.sh format problems Marco Stornelli
2012-08-31 17:08 ` Junio C Hamano
2012-09-01 7:52 ` Marco Stornelli
2012-09-02 18:44 ` Junio C Hamano
2012-08-31 20:01 ` Junio C Hamano
2012-08-31 21:35 ` Johannes Sixt [this message]
2012-09-01 7:43 ` Marco Stornelli
2012-09-01 13:59 ` Johannes Sixt
2012-09-01 19:18 ` Marco Stornelli
2012-09-02 20:42 ` Junio C Hamano
2012-09-03 10:51 ` Marco Stornelli
2012-09-03 15:48 ` Marco Stornelli
2012-09-03 20:16 ` Junio C Hamano
2012-09-04 6:37 ` Marco Stornelli
2012-09-04 9:01 ` Junio C Hamano
2012-09-04 11:22 ` Marco Stornelli
2012-09-04 15:49 ` Junio C Hamano
2012-09-04 18:59 ` Marco Stornelli
2012-09-04 19:22 ` Junio C Hamano
2012-09-05 6:30 ` Marco Stornelli
2012-09-02 18:42 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50412E2D.7070503@kdbg.org \
--to=j6t@kdbg.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=marco.stornelli@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).