Sublime Forum

Batch Editor - by Search and replace Regex or normal mode?

#1

hello. Is there any Batch Editor plugin or Package that could help me to perform multiple commands (a list of Regex Expressions or normal replace)?

I’m working with 5000 files, and I need to run many regex expressions, so those to run in order of my preference even if I’m leaving home. A Batch Editor Package will be perfect.

0 Likes

#2

There’s the Macro functionality on the Tools menu, but if that doesn’t suffice you should just write a Python script. Personally I’d just do that.

Someone else may be able to suggest a plugin though…

0 Likes

#3

hello nutjob2, Macro are not very good for many search/and replace on 5000 files. :slightly_smiling:
I don’t know Python, else I’d write a script for myself. I only know a bit of Regex. I am not a programmer, but I am working with a lot of .html or .txt files.

0 Likes

#4

Well, you might be right, but if the only tool you have is a hammer, you better start thinking everything looks like a nail.

I wouldn’t dismiss the macro approach out of hand, becuase most likely you will be turning a text file with a list of 5,000 file paths into a series of commands (using regex) that apply your regexes.

This looks like it may help you apply multiple regexes to each file:


I can’t find a plugin to run commands against multiple files, but this will help you open and save them:

https://packagecontrol.io/packages/FileCommands

You also might want to look at other tools (perhaps sed) which are designed to do what you’re talking about.

0 Likes