perl -pi -e 's/(?<=id=")(\d+)/$1+14/ge' filename.txtid="(.+?)" and replace with id="((($1+14)))". Then do a search for \(\(\(.+?\)\)\) and keep hitting shift-ctrl-C-2 (evaluate and replace) then Cmd-G to move on to the next item, etc. That's 6 keypresses, so for hundreds of items probably good to record it as a macro.id="(\d+?)" would be better for my first one, obviously.id="\([^"]+\)", replace with id=\,(+ (string-to-integer \1) 14).Filter Through Command...perl -nle '@nf = split(/id="*[0-9]"/); $_ =~ m/id="*[0-9]"/g; $f1 = $&; @f = split (/"/,$f1); $v = $f[1]+10; print $nf[0]."id=\"".$v."\"".$nf[1]; 'Input: Document, and Output: Replace Document in the dialog boxExecuteid="...". There's probably a cleaner regex to do this, but this should get you started, I hope.perl -pe 's/(?<=id=")(\d+)/$1+14/ge' for a cleaner solution within TextMate. BP, the (?<=...) is a zero-width look-behind assertion which means "match only after this", and the /e flag on the regex means "evaluate the replacement part".You are not logged in, either login or create an account to post comments
posted by pb at 3:21 PM on March 18