Page 1 of 1
Are printed line numbers all or nothing?
Posted: Fri Apr 21, 2006 6:46 pm
by greatrussian
I'd like to print a file with line numbers, but don't need every one. Is it posssible to set it to only print every 5th line number?
Posted: Fri Apr 21, 2006 7:39 pm
by talleyrand
At this point, TextPad does not offer the functionality you are looking for. As you asked, yes, printed line numbering is an all or nothing thing. Sorry to dissapoint. Perhaps some other soul out there will have an alternative solution for you.
Are printed line numbers all or nothing?
Posted: Mon Apr 24, 2006 1:55 pm
by Boris
First, add an extra blank line at the beginning of your program.
This will be "line 0", which can be removed afterwards.
Then Find and Replace the following:
Find : (^.*)\n(^.*)\n(^.*)\n(^.*)\n(^.*)\n
Replace : \i(0,5)######\1\n######\2\n######\3\n######\4\n######\5
Note: Use POSIX syntax
I put hashes to indicate blank spaces. Please replace them before running. They are there to give a nice indentation to the result. Change as needed.
After running this, delete "line 0".
This will work through the whole of the text, EXCEPT the last few (5) lines (depending on the line numbers).
You can correct that manually yourself.
I hope this solution is useful.
Maybe someone could refine it further for you.
Cheers,
Boris.
Posted: Mon Apr 24, 2006 3:09 pm
by greatrussian
Thanks, I changed the replace to
Code: Select all
######\1\n######\2\n######\3\n######\4\n\i(5,5)##\5
which eliminated having to add an extra line at the beginning. Unfortunately, the indentation lines up only when there are the line number is 4 digits long.
Posted: Mon Apr 24, 2006 4:04 pm
by Boris
Thanks, I changed the replace to
Code: Select all
######\1\n######\2\n######\3\n######\4\n\i(5,5)##\5
which eliminated having to add an extra line at the beginning.
Ah, of course.
Unfortunately, the indentation lines up only when there are the line number is 4 digits long.
Yes, the indentation is a problem.
I initially tried with tabs (\t), but they have the same problem.
As someone said before, it would be nice to have the \i work with left-padded zeroes.