replacing a special character

L

laredotornado

Hello,

I'm running Fedora Linux Core 5. I have some weird characters in my
files that are causing HTML validation to fail. In vim, they appear
like

Anderson<92>s

where "<92>" is this odd character. It should really be an
apostraphe. My question to the group is how do I run a perl search
and replace command along the lines of

perl -pi -e 's/old_expr/new_expr/g' myfile.html

to swap out the bizarre "<92>" character with an apostraphe?

Thanks, - Dave
 
P

Paul Lalli

I'm running Fedora Linux Core 5. I have some weird characters in my
files that are causing HTML validation to fail. In vim, they appear
like

Anderson<92>s

where "<92>" is this odd character. It should really be an
apostraphe. My question to the group is how do I run a perl search
and replace command along the lines of

perl -pi -e 's/old_expr/new_expr/g' myfile.html

to swap out the bizarre "<92>" character with an apostraphe?

Sounds like you have a "smart quote" in there. Hex 92 is Decimal 146,
which is the ' character in whatever character set I'm using....

I would try:
perl -pi -e"s/\x22/'/g" myfile.html

Paul Lalli
 
P

Peter J. Holzer

Sounds like you have a "smart quote" in there. Hex 92 is Decimal 146,
which is the ' character in whatever character set I'm using....

I would try:
perl -pi -e"s/\x22/'/g" myfile.html

ITYM:

perl -pi -e"s/\x92/'/g" myfile.html

hp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,667
Latest member
DaniloB294

Latest Threads

Top