Copy link to clipboard
Copied
Have an index with duplicated entries:
the tempest*230-231, 247, 316
the tempest*370, 390
(between the entry and the numbers we may have any delimiter element: *, tab, etc
and need to «grep» this to get:
the tempest*230-231, 247, 316, 370, 390
(the page order is not necessary)
thanks
It can be done with GREP.
The basic idea is to search for something like this:
^(.+?)\*(.+)\r\1\*(.+)
and replace with
$1 $2, $3
This will work with your exact example with the *. If you're using a different delimiter. replace the \* with [*\t] and whatever else might be the delimiter.
The trick here is to use the \1 to refer to whatever was captured initially.
HTH,
Ariel
Copy link to clipboard
Copied
I don't know how to GREP this, but for this to happen in the first place, it must be that there is a difference in the way the second two items have their index entry compared to the first two. (I don't know any other reason that this would happen) I would approch this by going into the index panel and fixing the entries for the second two items to exactly match the first.
Copy link to clipboard
Copied
We have a book divided into two files.
That is the reason behind two similar entries as some topics are present in both files.
With a list of words suggested by the author, we got for the moment this output.
Thanks.
Copy link to clipboard
Copied
You can avoid this sort of duplication in your index by connecting the two files with an InDesign Book file.
Copy link to clipboard
Copied
It can be done with GREP.
The basic idea is to search for something like this:
^(.+?)\*(.+)\r\1\*(.+)
and replace with
$1 $2, $3
This will work with your exact example with the *. If you're using a different delimiter. replace the \* with [*\t] and whatever else might be the delimiter.
The trick here is to use the \1 to refer to whatever was captured initially.
HTH,
Ariel
Copy link to clipboard
Copied
the tempest*230-231, 247, 316, 370, 390
YES
undeniable, it is magic. your answer is full of elegance and generosity.
thanks.
Copy link to clipboard
Copied
$1*$2, $3
is a variation to preserve the *
Copy link to clipboard
Copied
to preserve the consecutive order of numbers:
$1*$3, $2
BID*5, 156, 214, 216, 260, 293, 300, 386, 431
instead of
$1*$2, $3
BID*214, 216, 260, 293, 300, 386, 431, 5, 156