Mateo Torres
Mateo Torres

Reputation: 1625

multiple selection every N lines Sublime Text

I have a very large file (~100k lines) and I want to insert a comment every 100 lines, I can write a script to do it, but I wonder if something like this is possible in Sublime (In emacs is pretty straightforward).

Upvotes: 16

Views: 8551

Answers (1)

jwpfox
jwpfox

Reputation: 5232

How about this regex to find 100 lines at a time

((.*\n){1,100})

and then replace with

\1
// this is a comment

Is that close enough for whatever it is you are trying to achieve?

Edit: This version of the replacement text suggested as better by @Maluchi

\1\n
// this is a comment\n

Upvotes: 31

Related Questions