Finding a string consisting of 2 spaces in TextEdit

Discussion in 'OS X Yosemite (10.10)' started by abr88, Jun 6, 2016.

  1. abr88 macrumors newbie

    Joined:
    Nov 22, 2015
    #1
    I want to find all occurrences of ' ' (not counting the quotes) in a .txt file. Is this possible? When I type the 2 spaces into the "Find" area, it doesn't seem to find them. Thanks.
     
  2. ardchoille50 macrumors 68020

    Joined:
    Feb 6, 2014
    #2
    I created a text file with some spaces, double spaces and triple spaces, and TextEdit found them all as I typed into the search field. I did notice that there was a second or two of time between me pressing the space bar and the spaces actually being found.
     
  3. abr88 thread starter macrumors newbie

    Joined:
    Nov 22, 2015
    #3
    That works for me when I just type in 1 space as the target -- all the occurrences of one space turn white. (If there's more than one consecutive space, only the first space shows up white.) But if I continue my "Find" request by hitting spacebar again to type in a second space, TextEdit seems to revert to doing nothing -- nothing shows up in white. Any help much appreciated!
     
  4. ardchoille50 macrumors 68020

    Joined:
    Feb 6, 2014
    #4
    I'm at a loss, my copy of TextEdit.app doesn't act that way and I don't see anything in settings that would interfere with searching. Perhaps someone else can chime in with an answer.
     
  5. abr88 thread starter macrumors newbie

    Joined:
    Nov 22, 2015
    #5
    Just to clarify -- Finding one space:
    Screen Shot 2016-06-06 at 7.36.00 PM.jpg
    Daring to type spacebar a second time:
    Screen Shot 2016-06-06 at 7.36.25 PM.jpg
     

    Attached Files:

  6. ardchoille50, Jun 6, 2016
    Last edited: Jun 6, 2016

    ardchoille50 macrumors 68020

    Joined:
    Feb 6, 2014
    #6
    I'm no expert on text files, but could it be an issue with that file (tabs sometimes look like spaces)? Could I get a copy and test it here?
     
  7. dsemf macrumors regular

    Joined:
    Jul 26, 2014
    #7
    Is it possible that your sample does not have any double spaces? It appears to me that the places that might have double spaces have tabs instead.

    DS
     
  8. ardchoille50 macrumors 68020

    Joined:
    Feb 6, 2014
    #8
    I haven't figured out how to get TextEdit.app to find tabs and new lines. This is why I use TextWrangler, you can find tabs with '\t' and new lines with '\n'. I wonder if TextWrangler would suit the OP's needs better than TextEdit.
     
  9. abr88 thread starter macrumors newbie

    Joined:
    Nov 22, 2015
    #9
    The file is attached. artchoille50: Your theory sounds very possible. Is there a way to "Find" a tab? Glad to try that if I knew how to put a tab in the Find area!
     

    Attached Files:

    • LPs.txt
      File size:
      2.1 KB
      Views:
      37
  10. ardchoille50 macrumors 68020

    Joined:
    Feb 6, 2014
    #10
    Thank you for supplying the file for me to test. @dsemf was right, the reason you cannot find any two or three consecutive spaces is because there aren't any. There are, however, lots of tabs. The only way to find a tab in TextEdit is to copy one to the clipboard and paste it into TextEdit's search box - TextEdit.app doesn't support searching for tabs with '\t'.

    You might want to install TextWrangler, link here. In TextWrangler, you can enter '\t' ,for tabs, and '\n' ,for new lines, in the search field (without the quotes) and it will find them. I have replaced TextEdit.app with TextWrangler on my Mac because it just seems to better suit my needs.
     
  11. dsemf macrumors regular

    Joined:
    Jul 26, 2014
    #11
    It turns out that option-tab can be used as a search argument in TextEdit to match tabs.

    DS
     
  12. ardchoille50 macrumors 68020

    Joined:
    Feb 6, 2014
    #12
    Thank you for this wonderful tip! Using your example, I found that the Option+Enter can do the same when searching for new lines.
     
  13. JohnDS macrumors 65816

    Joined:
    Oct 25, 2015
    #13
  14. ardchoille50 macrumors 68020

    Joined:
    Feb 6, 2014
    #14
  15. JohnDS macrumors 65816

    Joined:
    Oct 25, 2015
    #15
    And TextWrangler allows you to edit your /etc/hosts file, which you can't do with TextEdit.
     
  16. abr88 thread starter macrumors newbie

    Joined:
    Nov 22, 2015

Share This Page