Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
615 views
in Technique[技术] by (71.8m points)

sublimetext2 - Sublime Text 2: How to delete blank/empty lines

Let's say I had a text file with the following nine lines:

foo

bar

baz

qux

quux

How can I use Sublime Text 2 to remove all four of the blank/empty lines, leaving only five lines?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Select the text

Press:

  • Ctrl + H on PC, or
  • Command + Alt + F on Mac or
  • Click Find->Replace.

Make sure you have selected 'regular expression' by pressing:

  • Alt + R on PC or
  • Command + Alt + R on Mac or
  • Click .* in the Find box.

Find what: ^ or ^( | ?)

Replace With: (nothing, leave in blank).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...