Sublime Forum

Extract lines from text file?

#1

All,
Total RegEx newbie here, and just trying to see if there are any text editors that might be able to help me with this. I have a list of thousands of words in a text file. They are in alphabetical order, one word per line.

What I would like to do is to either:

  • Reorder the lines so that they are in order of how many characters are in the word (ie. so I can easily go in and then just grab all the 3 letter words and move them to a new file, then move the 4 letter words to a new file, etc.)
  • Run a RegEx (or something) to delete all the lines that don’t have an exact number of letters (ie. so I could end up with a file of all the 3 letter words, as example)

Is this something I can “easily” do in Sublime?

If not, any suggestions on where I might search to find a solution to this?

Thanks so much!

0 Likes

#2

Please disregard this question.

While I had done a bunch of surfing for a RegEx solution before coming to ask, I had not searched well for this option:

And I found a package to do just this:
https://github.com/Doi9t/SortBy

Thought I would share this in case anyone stumble upon my question needing a similar answer. :slight_smile:

0 Likes