using perl to sub § for \xa7.

Gary Kline kline at tao.thought.org
Sat Mar 18 00:38:18 UTC 2006


On Fri, Mar 17, 2006 at 06:14:17PM -0500, Parv wrote:
> in message <20060317072405.GA249 at thought.org>,
> wrote Gary Kline thusly...
> >
> > I've got several chapters with footnptes with that double-S
> > "section" character.  In HTML, the code is &sect;   The thing I
> > want to do is use perl to s/ \xa7/&sect;/g.....but don't know the
> > keycombo to /find or designate tthe hex a7 byte.  Can anybody clue
> > me in?
> 
> Use '-i' option for in place editing, '-p' to print the results to
> the file, '-e' to specify the code to run ...
> 
>   perl -pi -e 's/\xa7/&sect;/g' file-1 file-2 file-3
> 

	Yeah, this is what I use for most cmd-line subs, but 
	will a literal "\xa7" be interpreted by the shell as the 
	section character?  (Where is there an online map of all
	ISO-8859-1 keycodes?  [E.g.: an aigu is <alt>-i; it is
	"\xe9" in keystrokes.])

> 
> ... if you have quite many files use 'find' to find the HTML files,
> say in directory named '/html/files' ...
> 
>   find /html/files -type f -name '*.html' -print0 \
>   | xargs -0 perl -pi -e 's/\xa7/&sect;/g'
> 
> 
	Thanks.  I've still got does dozens of files/chapters. 
	X-|

	:)

	gary



>   - Parv
> 
> -- 
> 
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"

-- 
   Gary Kline     kline at thought.org   www.thought.org     Public service Unix



More information about the freebsd-questions mailing list