help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: PO-mode help, please


From: Kevin Rodgers
Subject: Re: PO-mode help, please
Date: Tue, 22 Feb 2005 12:51:23 -0700
User-agent: Mozilla Thunderbird 0.9 (X11/20041105)

Tim Morley (forstreku la legoman koloron de mia retadreso) wrote:
> I need to find each record that includes the comment below:
>    # FAKVORTO: MATEMATIKA
>    msgid "Absolute Value"
>    msgstr "Absoluta Valoro"
>
> It may appear as one of several comments, in which case I need to copy
> over all of the comments:
>    # Aux ALD (laux la franca AJT)? (Gian Piero SAVIO, 2004-04-02)
>    # 'ALDONI' estas plej klara; 'ALD' iom malpli, do konservu la unuan.
>    (Tim Morley, 2004-04-03)
>    # FAKVORTO: MATEMATIKA
>    msgid "ADD"
>    msgstr "ALDONI"
>
> And the comments may not appear in any particular order:
>    # Nur la franca uzas verban terminon, cxiuj aliaj uzas substantivan
>    terminon. Atentu, "Combine" povus havi aritmetikan signifon, kies
>    preciza traduko estas "Kombinacio" (mi intertempe kontrolis en PIV1).
>    (Leo DC, 2004-08-13)
>    # Vi pravas, ke estas cxiutaga kaj matematika sencoj por tiu vorto.
>    Mi enmetos ambaux. (Tim Morley, 2004-09-23)
>    # FAKVORTO: MATEMATIKA
>    # PLURSENCAJXO
>    # Kombinajxo
>    msgid "Combination"
>    msgstr "Kunigado"
>
> If somebody could suggest either an EMACS keyboard macro, or possibly a
> SED or AWK script, that would spit out a text file containing all of the
> above records from my collection of files, it would be a great help to me.

I think awk is the way to go:

awk '/^#/ {comment[c++] = $0}
     /^# FAKVORTO: MATEMATIKA/ {verify = 1}
     /^msgid/ {msgid = $0}
     /^msgstr/ {if (verify == 1) {
                  for (l=0; l<c; l++)
                    print comment[l]
                  print msgid
                  print
                  }
                c = 0
                verify = 0}'

--
Kevin Rodgers

reply via email to

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