0

I am in TextWrangler, trying to grep for all sets of more than one consecutive space. I want to replace all these instances of multiple spaces with a single space. E.g.,

Find "Cognitive Impenetrability of          Visual Perception" Replace with "Cognitive Impenetrability of Visual Perception"

I've checked all the recommended threads on this and none of them are working for me.

Any advice on how to search (or Grep) for multiple spaces is welcome.

Nick Byrd
  • 163
  • 1
  • 14

2 Answers2

0

In TextWrangler

From menu Search go select Find... to get to the Find & Replace box.

In Find you type: "*" (i.e. two spaces followed by *)

In Replace you type "" (one space)

Don't forget to select box grep, and then press Replace all.

Marc Lambrichs
  • 2,864
  • 2
  • 13
  • 14
  • Thanks. It turns out that the characters I was trying to replace were not spaces after all. I tried what you recommended and nothing happened. So I copied two of the space-looking characters and then pasted them into the "Find" textbook, before the star. And when I hit the "Replace All" button, it was fixed. I had to do this with a couple different space-like characters to get rid of all the extra space(s). Thanks for your help! – Nick Byrd Sep 04 '17 at 19:57
0

Here is what worked:

I would look for an instance of multiple spaces, copy two consecutive space-looking characters, and then paste the characters into the "Find" textbox, and add a star:

[mystery character][mystery character]*

Then I clicked the "Replace All" button. This fixed about one-third of the spacing issues.

I continued this method (two more times, I think) until the rest of the space issues (that I found) were fixed.

Nick Byrd
  • 163
  • 1
  • 14