[TxMt] Executing command on all files in a project AND using TM variables in a search and replace

J Fishwick fishwick.hmco at gmail.com
Thu Oct 19 20:12:02 UTC 2006

In all the files in my project, where a certain string of characters is present,
I'm trying to replace a string with the a part of the file name containing said

For example, files are called ace[1-12].xml, and for everytime there is a the
block: "mc\d+(.*\n.*True)" I want to replace mc\d+ with tf0(number prefix from
filename). I know this hits on a couple more adavanced concepts I don't have a
full grasp on yet, but this editor is goading me on to learn regex and basic
command line skills...

The command I have now is: 

Save: nothing

eval arr=("$TM_SELECTED_FILES")
for (( i = 0; i < ${#arr[@]}; i++ )); do
perl -pe 'while ($string =~ m/mc\d+(.*\n.*True)/g) {$string =~

Input: Entire Doc

Output: Replace selected text

It's choking big time... any pointers to the numerous places I'm screwing up?


More information about the textmate mailing list