Sublime Forum

How to insert something at the beginning of each document?

#1

hi, can anyone tell me how to insert something at the beginning of each document, without replace any word?

Supose I want to add at the beginning of each 500 html files, a simple row like , how can I do this?

0 Likes

#2

I would do that by writing a program.

For all files in folder
open file
insert x

tips with python

0 Likes

#3

can you please writing the syntax?

0 Likes

#4

I do not have a finished code for you to use - have you used python before? Else it may be hard without some time investment from your side.

Maybe there are other alternatives that are more interesting?

0 Likes

#5

Search:
^\A(.*)$

Replace with:
ANYTHING $1

0 Likes

#6

or, another nice and simple regex solution. This will insert a new line at the beginning of file.

Search
(?s)(.*)

Replace by:
ANYTHING \r\n\1

0 Likes