Shaun Abram
Technology and Leadership Blog
Sublime notes
The following are some notes & examples of using Sublime Text for quick text editing, typically using regular expressions.
All the examples below typically start with:
- Go to the Find → Replace
– or press ⌘ Cmd + Alt + F on Mac - Select the ‘Regular expression‘ by clicking on the .* button in the – or press ⌘ Cmd + Alt + R on Mac
How to delete all lines starting with a number/digit
1. In the Find field, type in:
- ^[[:digit:]].*
2. Leave the Replace field empty
3. Click on the Replace All button
How to delete empty lines
1. In the Find field, type in:
- ^(\r|\n\r?) to delete empty lines including those with whitespace
- ^\n to delete empty lines excluding those with whitespace
2. Leave the Replace field empty
3. Click on the Replace All button
Credit: https://www.shellhacks.com/sublime-text-remove-empty-lines/