Ask Your Question
2

How can I automatically remove certain index entries? [closed]

asked 2012-12-12 20:42:38 +0200

wolfgang61 gravatar image

updated 2014-06-23 19:10:53 +0200

bencomp gravatar image

I accidentally added an index on all occurrences of a very common short word. Undoing is no option, I continued editing afte that. It seems libreOffice only allows me to remove them one by one with a lot of manual work.

But it should be possible to write a script which unzips .odt, removes those indexes from content.xml and correctly zips .odt again.

Usage would be

remove_odt_index file.odt targetA targetB ...

Does such a script already exist?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-02-26 00:05:48.465527

2 Answers

Sort by » oldest newest most voted
3

answered 2014-06-22 03:36:06 +0200

oweng gravatar image

updated 2014-06-22 03:46:48 +0200

There is an example bash script function, of the type indicated in the question, provided in this AOO forum thread. Here is an adapted version:

#!/bin/bash
unzip -p "$1" content.xml | sed -r -e 's,<text:alphabetical-index-mark-(start|end)[^>]*>,,g' > /tmp/content.xml && n="$(basename "$1" .odt)"_removed.odt;
cp "$1" "$n" && zip -j "$n" /tmp/content.xml

Given doc_with_index.odt as input to the above bash script (rm_index.sh), doc_with_index_removed.odt will be written out e.g., $ rm_index.sh doc_with_index.odt

edit flag offensive delete link more
2

answered 2012-12-13 00:28:19 +0200

m.a.riosv gravatar image

What do you do to add index?

You can select the word in the all document with Find & Replace (Ctrl+F Menu/Edit/Find&Replace).
Search: TheWord
Find all This select all ocurrences of the word.
Apply the desired format.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-12-12 20:42:38 +0200

Seen: 745 times

Last updated: Jun 23 '14