Discussion:
[TxMt] removing blank lines in list
Lewy
2013-06-22 18:21:03 UTC
Permalink
I often receive lists to publish. When they come in, there are blank
lines between each item. Adding markup is easy. It _should_ be easy to
remove the blank lines, but I'm a klutz with regex. Can someone suggest
an easy way to bet rid of the blank lines.
Timothy Bates
2013-06-22 19:18:30 UTC
Permalink
Lines with nothing but blank space will match

\n *\n

just record a macro where you find and replace that with \n

then play it in files you want to cleanse.

There are likely better solutions

t
I often receive lists to publish. When they come in, there are blank lines between each item. Adding markup is easy. It _should_ be easy to remove the blank lines, but I'm a klutz with regex. Can someone suggest an easy way to bet rid of the blank lines.
_______________________________________________
textmate mailing list
http://lists.macromates.com/listinfo/textmate
Gerd Knops
2013-06-22 19:18:17 UTC
Permalink
- Check "Regular Expression"
- Find: \n+
- Replace: \n
- "Replace All"

Or if you can't remember, copy 2 linefeeds into the Find field, 1 linefeed into the Replace field, and do "Replace All" until no more matches are found.

Gerd

PS: if there also is random space in the 'blank' lines, replace the "Find" expression with \n\s*\n
I often receive lists to publish. When they come in, there are blank lines between each item. Adding markup is easy. It _should_ be easy to remove the blank lines, but I'm a klutz with regex. Can someone suggest an easy way to bet rid of the blank lines.
_______________________________________________
textmate mailing list
http://lists.macromates.com/listinfo/textmate
Loading...