Find in files: zero pad line numbers

Ideas for new features

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

Post Reply
tomlamson
Posts: 10
Joined: Mon Nov 24, 2003 5:30 pm

Find in files: zero pad line numbers

Post by tomlamson »

I often use find in files and then save the results to a text file and sort on a column number. I want to keep the file name and line number so that I can always resort to get the original order or to manually search the original file. This would be easier if the file number was left padded with zeroes. e.g. if a file has 100 to 999 lines then give a 3 digit line number e.g. (003) (029) (487). Loved TextPad for many years now! Thanks for a great product!
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

You can fix them in two steps:
Find what: \<([0-9])\>
Replace with: 00\1

[X] Regular expression
Find what: \<([0-9]{2})\>
Replace with: 0\1

[X] Regular expression
These assume you are using Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
Post Reply