Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Hello again Superuser!

I have ~40 .txt files with rows like this:

11:20 : Go to lunch
13:40 : Go to parkinglot 
14:40 : Wait for flight to arrive
.. 
(and so on for ~90 lines per txt file)

And I need to change it into this:

1. Go to lunch
2. Go to parkinglot
3. Wait for flight to arrive
...

I've tried using Notepad++ using it's replace tool (CRTL+H) with this regex:

\d{2}:\d{2} : 

But that doesn't change the numbers into increasing numbers.

Can anyone suggest a way to accomplish this?

share|improve this question

2 Answers 2

This solution uses both your regex and a function from a plug-in, packed into a macro for automation.

1) Get the "TextFX Characters" plugin. (Plugins->Plugin Manager)

2) Start recording your macro (Macro->Start Recording)

3) Use your existing regex to replace the timestamps with a period, you are left with this:

. Go to lunch
. Go to parkinglot 
. Wait for flight to arrive
.. 

4) Select all your text (ctrl-a)

5) Insert Line Numbers (TextFX->TextFX Tools->Insert Line numbers)

00000001 . Go to lunch
00000002 . Go to parkinglot 
00000003 . Wait for flight to arrive
00000004 ..

6) Remove zeros and shift period with regex -> Find what: "0+(\d) ." Replace with: "\1."

1. Go to lunch
2. Go to parkinglot 
3. Wait for flight to arrive
..

7) Stop recording the macro (Macro->Stop Recording)

share|improve this answer

If you have access to Microsoft Word (or equivalent),

  1. Copy the text into Microsoft Word.
  2. Delete the times with Microsoft Word’s “Find and Replace” function, replacing them with nothing.
    (Or use some other tool to strip off the times, but then copy into Microsoft Word at this point.)
  3. Number the lines.
  4. Copy and paste back into Notepad++.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.