The text in the cells was regular, but not amenable to a simple search, because it looked like this
1. Alpha
2. Bravo
The fix, in Emacs, was really quick.*
1. I copied the column and pasted it into Emacs, where it became a series of lines of plain text.
2. I copied the number-and spaces prefix on one line to get a string with the correct number of spaces.
3. I did a replace-regexp command, replacing ".. " (2 periods, 3 spaces) with nothing. Since the period is a single-character wildcard in a regular expression, that meant 'find strings consisting of any two characters followed by three spaces'. This converted my lines to the following:
Alpha
Bravo4. I copied the modified lines and pasted them over the column. All better.
Actually, I had to do a little more cleanup than this, because there were some two-digit numbers, but you get the idea.
There are several wins here. It's smart of Excel to so nicely accept pasted input in the form of lines. This comes in handy for me all the time. And Emacs' ability to do replaces on regular expressions is extremely powerful.
--------------
*Now that I think of it, it would probably have been even faster to fix this in Word before pasting the table into Excel. In Word, I could have changed the numbered paragraphs to non-numbered ones.
No comments:
Post a Comment