On 03/10/2007, Jamal Shahin jshahin@gmail.com wrote:
- the numbering system I used for the files was based on a primary
key from our database, but I've been asked to renumber all the files starting from 1 (for a silly reason, the database started with a primary key of 67, and manually-entered records start at 400.). *Is there any way that I can use TM to convert "##number ##" into "## incremental number ##"?* e.g. in find and replace, use: find: ##(\d*)\w? ## (the \w? is there as a couple of documents are labelled like: 137a) replace: ##(x+1) ##
It's the (x+1) that's bothering me.
You can do this easily enough using a one-line Perl script, as follows.
1. Choose "Filter through command…" from the Text menu, or press apple-option-R. 2. Choose Input: Document, and Output: Replace document. 3. For the command, put the following:
perl -le 's/##\d+\w? ##/++$n/eg'
That will convert your numbers to 1, 2, 3, 4, etc. in order, which is what I think you want.
Robin