Massaging Text with InDesign (Getting the Text You Want from the Text You Have)

When faced with a complicated text processing task, why look any farther than InDesign to manage it?

Sometimes the text I need is hidden inside a bunch of other text. For example, here’s a web page that lists, among many other things, a bunch of emails I need:

The blue column in the middle is the list of emails. I’m sure there are web utilities that let you grab just one column, and there’s that cool trick of Option/Alt-dragging in MS Word to get a column… but I want to show you how you can use InDesign to pull text out of a bunch of data like this.

I copy and pasted the whole page into InDesign, and you can see that it’s a mess:

But I also notice patterns! In this case, we need to remove all the lines that have just the user name followed by a bunch of tabs. So I whip up this quick grep:

That looks for a word followed by four tabs, followed by a return, followed by the same (duplicate) word. It then replaces it with the word itself. Obviously, your grep would be different, depending on what kind of pattern you find.

I click Change All, and end up with a nice clean list, with one email on each line:

In order to grab just the emails addresses, I need to put them in a single column. So I select all the text and choose Table > Convert Text to Table:

The result is a nice, orderly table:

Now it’s easy to select all the columns I don’t need and delete them, leaving me with a single column table. Choose Table > Convert Table to Text and I end up with what I wanted all along:

Sounds like a lot of work, but the point of this post is: InDesign can do all kinds of text massage/processing that many people leave to text editors or word processors. InDesign is where I’m fastest and most comfortable, so here’s where I do it!

Bookmark
Please login to bookmark Close

This article was last modified on April 9, 2021

Comments (8)

Leave a Reply

Your email address will not be published. Required fields are marked *

Loading comments...