Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #10081

    user
    Participant

    hello!

    I want to number the lines of a text file, by inserting 1), 2), 3), etc at the begining of each line

    how can this be done?

    thanks!

    #10082

    webern
    Member

    You can use Insert Sequence Numbers plug-in (32-bit)

    or a .jsee-macro like this one:

    var n = document.GetLines();
    var a = new Array();
    for (var i=1; i<(n+1); i++) a.push(i + ") " + document.GetLine(i));
    document.selection.SelectAll();
    document.write(a.join(“n”));
    Quit();

    #10086

    Stefan
    Participant

    a) make an zero-width selection in front of the lines
    b) execute “Edit > Advanced > Numbering…”
    c) press [OK]
    Note: to pad with zeros enter them into the “First Line” field like “01” or “0001”

    d) while still have that inserted numbers selected do an regex s&r:
    Find: (dd)
    Replace with: 1)

    [X]Use regex
    [X]In selection only

    Note: the amount of find “d” patterns depends on how many zeros you have padded.
    “dd” will match two digits.
    “ddd” or “d{3}” will match three, and so on…

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Share with friends... Tweet about this on TwitterShare on FacebookShare on Google+Email this to someone