Page 1 of 1

Can line numbers be copied

Posted: Fri Feb 24, 2006 11:34 pm
by dmaggian
I need to reference line numbers when documenting some source code. I'd like to turn line numbers on in TextPad and then copy the text, including the line numbers, and paste it into my other publishing tool. Can this be done? I've searched the forums and the options but don't see a way to do it.

Posted: Sat Feb 25, 2006 1:06 am
by Bob Hansen
Two quick possibilies:

1. You can set up printing to include numbers.
Then print to a file.

2. You can insert numbers at front of each line.
Use Column Select Mode, then Edit, Fill Block.

Posted: Wed Mar 01, 2006 4:23 am
by I Steal Toast
Some programming languages are able to insert the line number into the code. For example in C, if you write printf("%d\n",__LINE__");, with most compilers it will print the line number the statement is on.

Posted: Wed Mar 01, 2006 8:02 am
by bveldkamp
And yet another possibility, if you have grep:

Code: Select all

grep -n ^ <filename>
This can be installed as a tool in Textpad.