1

I have a sample data like this:

#10009
#10009
#10010
#10010

And I want to make it like:

#10009
#10009.
#10010
#10010.
1

2 Answers 2

6

Find & Replace, "Regular expression":

Find (.*\r\n.*)(\r\n), replace with \1.\2

(Assumes you have Windows line endings and the last line ends in a \r\n)


Explanation:

  • .* matches anything any number of times.
  • \r\n is Windows carriage-return line-feed end of line.
  • ( and ) denote capture groups. These are what the \1 and \2 refer to in the replace string.
1
  • 1
    Also, make sure the . matches newline option box is not checked, or this will give undesired results. Apr 23, 2015 at 16:20
2

You could also use macro recording to solve this. If you put your cursor before the first of the pairs (on line one), hit Start Recording, then hit "Down|End|.|Down|Home" and then Stop Recording. Then you can use Macro|Run a macro multiple times|Run until end of file.

The Regex solutions offered can be more powerful, but using a macro to solve simple problems can be easier to understand and faster for those not well versed in Regex.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .