Sublime Forum

Creating one file as a result of a selection of others files

#1

How can I create or update one file as a result of selecting some rows from other files??

I don’t know how to do this outside Sublime Text (maybe with some Python I could…), but I wonder anyway if it is possible to do something like this by using any kind of “functions” in Sublime Text:

I have several files with lots of data. I want to select those lines of those files containing one asterisk, for example.

EDIT: I mean, I would like to select every line that contains one asterisk, whatever the file it belongs.

Then, I want to copy and paste those lines into a new file, or just to append them to an existing file, maybe adding some prefix indicating the origin file.

Is it possible to automatize that action in Sublime Text?? How could I do that?

If not, could anyone give me some hint about the best way to address this task (for example, Python…)??

EDIT: OK, I am thinking of a “pushing-a-button” solution, but I realize that it would be also possible to do it “by hand”, just by using all the “tricks” (multiple selections and so on) available in Sublime Text. So, in that case: my question is: how would you perform such a task periodically (say, once per week)??

Looking forward to your answer,

0 Likes

#2

Maybe I should be more specific.

Let’s say I have a Sublime Text project with up to 10 files, more or less.

Those files are going to be populated with lists of things (to-do lists, and more).

In each file, each day some of the lines are going to be labeled with an asterisk, or another similar character. I mean, I will add an asterisk at the beginning of the line.

Each day, I would like to copy the different rows labeled with an asterisk and copy them to a “master” file.

What would be your preferred way to do this repetitive task in Sublime Text?

Looking forward to your help,

0 Likes

#3

You can combine regex with the Find in Files menu command in ST2 and it will populate the result in a new scrach file contained the filtered lines and the correspond file these lines resided in, etc.

0 Likes