Page 1 of 1

Adding a number

Posted: Sat Mar 22, 2014 1:12 am
by JasonGH
I have a sample of a text file below with multi lines of data between each records

Record 123
[MULTI LINES OF DATA HERE]
Record 124

Record 125

Record 130

Record 163

Is there anyway to add a number to the record number using marco and/or RE? For example if adding 50, my text file will look like this:

Record 173
[MULTI LINES OF DATA HERE]
Record 174

Record 175

Record 180

Record 213

Thanks

Posted: Sat Mar 22, 2014 9:55 pm
by ben_josephs
No. Regular expressions can't count or add: all they know about is uninterpreted characters. In principle you can do this, but not with a single search-and-replace operation. It would be very tedious and would require many separate and different search-and-replace operations.

This is a job for a script in a suitable language, such as Perl, Python, Ruby, Tcl, ECMAscript or Lua. TextPad doesn't support scripts.