copy 10 lines of code to all open documents

  • hello !
    I have to add a script in 80 html pages…
    can I paste all open documents?
    the script is about 10 lines
    thanks for answers

  • I would probably just write a script for this. maybe use batch or powershell to copy the text in you script, and append it to the end of your html.

    possibly ‘type’ (batch) or ‘out-file’ (powershell). Then just feed it a list of the file locations that need to get it and use a loop to add your script. Honestly, probably not worth the hassle, just paste em’ individually.

    simplified psuedo:
    for each line in ‘list of html paths’.txt
    append ‘script’.js to file at current line location

  • you can use a regex like this: \A^.*(?:\R.*){10} in the best regex software named grepWIn. The best and simple solution. Search with a regex then copy all 10 lines from as much documents you want.

    but, my regex is not verry good. Maybe guy038 will find a better regex to select all first 10 lines :)

  • could be \A(?:.*\n){10} but works just in sublime text, but not in notepad++

  • Hello, @angelica-bartoloni,

    As it’s my first post of 2018, allow me to wish you and every N++ user, a very productive year, with our beloved editor, a lot of opportunities and, of course, good health, throughout the year !

    Well, I supposed that all your HTML files are gathered in a specific folder, aren’t they ?

    The next question, Angelica, is : Where the script is supposed to be inserted, in these hmtl files ? I mean, could you give us the context ( a couple of lines before and after that insertion point ! )

    Finally, if not confidential, as it shouldn’t exceed 10 lines, could you, also post the script’s contents !

    With all that information, and the Built-in Replace / Replace in Files feature, it shouldn’t be very difficult to get the job done !

    See you later,

    Best Regards,


Log in to reply