l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2006 Oct 26 15:29

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] adding line numbers to an HTML file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] adding line numbers to an HTML file

On Thursday 26 October 2006 14:25, Micah Cowan wrote:
> On Thu, 2006-10-26 at 14:23 -0700, Dylan Beaudette wrote:
> > Hi everyone,
> >
> > wondering if there is a simple way to add line numbers to every non-html
> > tag in a webpage:
> >
> > here is a dirty hack that does not work very well:
> >
> > lynx -source http://casoilresource.lawr.ucdavis.edu/drupal/node/319/print
> > | cat -n > test.html
> >
> > or - if there is a way to add line numbers to non-tag data, similar to
> > how the paste (http://rafb.net/paste/) service works.
> >
> > any ideas would be very helpful!
> The link you show doesn't seem to distinguish "tag data", and it's
> really not clear to me exactly what you're trying to accomplish. Perhaps
> if you could post a short "before-and-after" example?
> Depending on what you want, Perl or Python--or possibly even just
> awk--should be able to meet your needs, but I can't really give you a
> solution until I understand the problem properly :)

some clarification is indeed warranted:

the page in question 
(http://casoilresource.lawr.ucdavis.edu/drupal/node/319/print) produces 
printer-friendly output (simple html). I would like to add line numbers to 
this document so that the students in my class can easily refer to specific 
lines of code. In my hack posted above, i add a line number to *every* line - 
even html tags like <head>, <body> , etc. I would like to add line numbers to 
the text in-between html elements. i.e

1 something
2 about 
3 some other thing
4 here

perhaps some regex-fu is required?

Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
O'Reilly and Associates
For numerous book donations.