Adding a number

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
JasonGH
Posts: 7
Joined: Sat Dec 07, 2013 12:24 am
Location: VA, USA

Adding a number

Post 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
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post 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.
Post Reply