Home Download Buy Blog Forum Support

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

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

Postby vicent on Mon Mar 11, 2013 1:33 pm

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,
_ v _ i _ c _ e _ n _ t _
vicent
 
Posts: 5
Joined: Sat Mar 09, 2013 6:41 pm

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

Postby vicent on Mon Mar 11, 2013 10:11 pm

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,
_ v _ i _ c _ e _ n _ t _
vicent
 
Posts: 5
Joined: Sat Mar 09, 2013 6:41 pm

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

Postby myunlessor on Tue Mar 12, 2013 1:30 am

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.
myunlessor
 
Posts: 19
Joined: Thu Mar 07, 2013 3:07 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 15 guests