regex replacement wizard advice needed
Fabian Keil
freebsd-listen at fabiankeil.de
Tue Sep 28 03:53:41 PDT 2004
On Monday 27 September 2004 21:28, Gary Kline wrote:
> I have a document with numbered paragraphs, the numbers
> to the far left of each paragraph. Is there a perl
> s/NNN/<B>NNN/</B><BR>/g means I can use from the CL or
> as a script to make this doc more easy (for me) to read.
>
> The document is formatted like this:
>
> 1 Paragraph1.
> 2 Paragraph2.
> ...
> 29 Paragraph29.
> ...
> 747 Paragraph747.
>
>
> I would like it to be like this:
>
> <B>1</B><BR>
> Paragraph1.
> <B>2</B><BR>
> Paragraph2.
> ...
> <B>29</B><BR>
> Paragraph29.
> ...
> <B>747</B><BR>
> Paragraph747.
I'd rather take something like:
(echo "<html><head><title>Title</title></head><body><h1>Title</h1><ol>";
perl -n -e 's@^\d+\s+(.*$)@<li><p>$1</p></li>@;print' input.txt;
echo "</ol></body></html>") >output.html
Without the line breaks, of course.
Semantic markup and valid HTML 2.0.
Regards
Fabian
More information about the freebsd-questions
mailing list