[TxMt] Re: How can I delete everything before a certain string...or a tab?

René Schwaiger sanssecours at f-m.fm
Wed Jul 15 07:24:28 UTC 2015


Hi,

you can also do the whole thing without regex if you like:

1. Move the caret to the position right before the word California
2. Select the whole thing by pressing ⌘⇧↑
3. Hit ⌥ to get multiple carets
4. Move to the end of the line by pressing ⌘→
5. Select the current words — the abbreviations — by pressing ^W
6. Hit ← to move the caret before the abbreviations
7. Select the text until the beginning of the line: ⇧⌘←
8. Hit ⌫ to remove the selected text

After that you get

AL
AK
AZ
AR
CA

To move the words into a single line press ^Q. Then your text looks something like this:

AL AK AZ AR CA

If you want to get rid of the spaces:

1. Select one space character and move it into the find clipboard by pressing ⌘E
2. Select the whole line: ⇧⌘L
3. Use “Find All” to get all occurrences of the space character: ⌘F
4. Delete the spaces by hitting ⌫

Kind regards,
  René

> On 15 Jul 2015, at 8:21 , jgalt <jgaltusa at gmail.com> wrote:
> 
> For example, how can I strip away the names of the states in this string and only keep he two character abbreviations?
> 
> (In my file the state names and abbreviations are separated by a tab.)
> 
> Alabama    AL
> Alaska    AK
> Arizona    AZ
> Arkansas    AR
> California    CA
> 
> 
> Also...how could I turn this string:
> 
> AL
> AK
> AZ
> AR
> CA
> 
> 
> into: AL¶AK¶AZ¶AR¶CA
> 
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate



More information about the textmate mailing list