[Solved] Convert 3-line entries to 4-line format

Discuss the word processor
Post Reply
TmTm
Posts: 8
Joined: Tue Nov 01, 2011 12:06 am

[Solved] Convert 3-line entries to 4-line format

Post by TmTm »

I would like to run a macro a specific number of times, but have not found an answer.
My file consists of 17k entries formatted as follows:
\lx abc [lexical entry]
\mr xyx [morphology]
\ge pqr [gloss]
...
My macro copies the \lx line, inserts it under the \lx line and replaces \lx with \ph, so that the wanted output is:

\lx abc [lexical entry]
\ph abc [phonology]
\mr xyz [morphology]
\ge pqr [gloss]
...
I want to either run the macro until \lx is not found, or more modestly, to run it as many times as I know there are \lx lines--about 17 thousand.
I appreciate your help.

 Edit: Changed subject, was Run a macro a specific number of times 
Make your post understandable by others 
-- MrProgrammer, forum moderator 
Last edited by MrProgrammer on Sat Oct 28, 2023 1:27 am, edited 1 time in total.
Reason: Tagged ✓ [Solved] -- MrProgrammer, forum moderator
OpenOffice.org 3.3
Windows 7
FJCC
Moderator
Posts: 9625
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Run a macro a specific number of times

Post by FJCC »

If I understand you correctly, this can be done with formulas instead of a macro. See the attached file. The formulas make a new column and you can keep the two columns or use paste special to replace the old column with the new values.
Attachments
lexical.ods
(12.47 KiB) Downloaded 100 times
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
FJCC
Moderator
Posts: 9625
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Run a macro a specific number of times

Post by FJCC »

I just noticed this is in the Writer forum. I should be able to save your file as a plain text document and import it to Calc to use my solution.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
User avatar
Zizi64
Volunteer
Posts: 11505
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Run a macro a specific number of times

Post by Zizi64 »

______________________________
OpenOffice.org 3.3
Windows 7
Please update your signature in this forum. I can not believe that you use the archaic old 3.3. version of the OpenOffice. Nobody will fix the bugs of that version, and nobody will remember how its features worked...

And I suggest you to change to the LibreOffice - if you not changed yet.
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Post Reply