I have about 45 files I'd like to combine into one, and short of opening each one and copy & pasting it into the new one, I don't see a clear way to do this in Textmate.
I'm certain there *is* a way, I'm just not seeing it. Suggestions?
Thanks!
On 2008-July-28 , at 10:20 , W. Thomas Leroux wrote:
I have about 45 files I'd like to combine into one, and short of opening each one and copy & pasting it into the new one, I don't see a clear way to do this in Textmate.
I'm certain there *is* a way, I'm just not seeing it. Suggestions?
use a shell script. Assuming the 45 files are the only ones in a directory:
touch .newfile for (( FILE in `ls *` )); do cat $FILE >> .newfile done mv .newfile newfile
NB: the first file has to have a point in front of the name so that it is not seen by ls and does not enter the loop
JiHO --- http://jo.irisson.free.fr/
On Jul 28, 2008, at 4:20 PM, W. Thomas Leroux wrote:
I have about 45 files I'd like to combine into one, and short of opening each one and copy & pasting it into the new one, I don't see a clear way to do this in Textmate.
I'm certain there *is* a way, I'm just not seeing it. Suggestions?
In bash you can do something like this:
for f in $(ls /path/to/files); do cat $f >> /path/to/newfile; done
On 28.07.2008, at 16:34, Alex Ross wrote:
On Jul 28, 2008, at 4:20 PM, W. Thomas Leroux wrote:
I have about 45 files I'd like to combine into one, and short of opening each one and copy & pasting it into the new one, I don't see a clear way to do this in Textmate.
I'm certain there *is* a way, I'm just not seeing it. Suggestions?
In bash you can do something like this:
for f in $(ls /path/to/files); do cat $f >> /path/to/newfile; done
Or, if you are using the project drawer you can select the desired files and execute a tmcommand à la:
Input: none Command: eval cat $TM_SELECTED_FILES Output: Create New Document
or write the output into a file
Input: none Command: eval cat $TM_SELECTED_FILES > ~/Desktop/myoutput.txt Output: none
The same could be achieved if one modifies that code to catch directories as well.
--Hans
Some good ideas. I then realized I could solve the problem simply, select all the files in a directory, copy, paste into Textmate (pastes file names), replaced the linefeeds with spaces, copied that, opened the shell and then typed (and pasted) cat file1 file2 file3 file4 etc
destination.txt
Worked like a charm.
Then, after all that, I realized that it was bbEdit that allowed me to open a slew of files into one. Handy, that.
Thanks all!
Tom
On Mon, Jul 28, 2008 at 11:00 AM, Hans-Jörg Bibiko bibiko@eva.mpg.de wrote:
On 28.07.2008, at 16:34, Alex Ross wrote:
On Jul 28, 2008, at 4:20 PM, W. Thomas Leroux wrote:
I have about 45 files I'd like to combine into one, and short of opening each one and copy & pasting it into the new one, I don't see a clear way to do this in Textmate.
I'm certain there *is* a way, I'm just not seeing it. Suggestions?
In bash you can do something like this:
for f in $(ls /path/to/files); do cat $f >> /path/to/newfile; done
Or, if you are using the project drawer you can select the desired files and execute a tmcommand à la:
Input: none Command: eval cat $TM_SELECTED_FILES Output: Create New Document
or write the output into a file
Input: none Command: eval cat $TM_SELECTED_FILES > ~/Desktop/myoutput.txt Output: none
The same could be achieved if one modifies that code to catch directories as well.
--Hans
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
Call me a lazy typist, but I prefer:
cat * >/some/new/file.txt
On Mon, Jul 28, 2008 at 11:13 AM, W. Thomas Leroux wtleroux@gmail.comwrote:
Some good ideas. I then realized I could solve the problem simply, select all the files in a directory, copy, paste into Textmate (pastes file names), replaced the linefeeds with spaces, copied that, opened the shell and then typed (and pasted) cat file1 file2 file3 file4 etc
destination.txt
Worked like a charm.
Then, after all that, I realized that it was bbEdit that allowed me to open a slew of files into one. Handy, that.
Thanks all!
Tom
On Mon, Jul 28, 2008 at 11:00 AM, Hans-Jörg Bibiko bibiko@eva.mpg.de wrote:
On 28.07.2008, at 16:34, Alex Ross wrote:
On Jul 28, 2008, at 4:20 PM, W. Thomas Leroux wrote:
I have about 45 files I'd like to combine into one, and short of opening each one and copy & pasting it into the new one, I don't see a clear way to do this in Textmate.
I'm certain there *is* a way, I'm just not seeing it. Suggestions?
In bash you can do something like this:
for f in $(ls /path/to/files); do cat $f >> /path/to/newfile; done
Or, if you are using the project drawer you can select the desired files and execute a tmcommand à la:
Input: none Command: eval cat $TM_SELECTED_FILES Output: Create New Document
or write the output into a file
Input: none Command: eval cat $TM_SELECTED_FILES > ~/Desktop/myoutput.txt Output: none
The same could be achieved if one modifies that code to catch directories as well.
--Hans
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
-- All about me! http://www.leroux.ca
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
<blink> Erm, well... yes, that is a better idea. I'll do that next time.
On Tue, Jul 29, 2008 at 4:18 AM, David Frascone dave@frascone.com wrote:
Call me a lazy typist, but I prefer:
cat * >/some/new/file.txt