tool to convert special characters of a file to html

tool to convert special characters of a file to html

Post by Zsolt Koppan » Tue, 17 Sep 2002 03:33:53



Hi,

I could somebody provide me a tool that replaces "\n" to "%0a" and "&" to
"%26" and "%" to "%25" of a file?

--
Zsolt

 
 
 

tool to convert special characters of a file to html

Post by Daniel Jense » Tue, 17 Sep 2002 03:38:35



> I could somebody provide me a tool that replaces "\n" to "%0a" and "&" to
> "%26" and "%" to "%25" of a file?

Try with tr or sed.

--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

 
 
 

tool to convert special characters of a file to html

Post by Bruce Stephen » Tue, 17 Sep 2002 04:41:38



> I could somebody provide me a tool that replaces "\n" to "%0a" and
> "&" to "%26" and "%" to "%25" of a file?

That doesn't look like an HTML question.  recode has features for
converting to HTML encodings, so:

           % echo 'salt & pepper' | recode ..h
           salt & pepper

(What you're asking for looks more like URI encoding, which recode
doesn't seem to support.)

 
 
 

tool to convert special characters of a file to html

Post by mjt » Tue, 17 Sep 2002 05:25:24



Quote:> I could somebody provide me a tool that replaces "\n" to "%0a" and "&" to
> "%26" and "%" to "%25" of a file?

... sed or recode or tr

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Michael J. Tobler: motorcyclist, surfer,  #    Black holes result
 skydiver, and author: "Inside Linux",     #   when God divides the  
 "C++ HowTo", "C++ Unleashed"              #     universe by zero

 
 
 

tool to convert special characters of a file to html

Post by Eric Worral » Tue, 17 Sep 2002 05:54:45




> > I could somebody provide me a tool that replaces "\n" to "%0a" and
> > "&" to "%26" and "%" to "%25" of a file?

> That doesn't look like an HTML question.  recode has features for
> converting to HTML encodings, so:

>            % echo 'salt & pepper' | recode ..h
>            salt & pepper

> (What you're asking for looks more like URI encoding, which recode
> doesn't seem to support.)

perl -pe 's/%/%25/g;s/\n/%0a/g;s/&/%26/g;s/%/%25/g' filename >
filename.out

or if you want to convert everything except alphanumeric and spaces,

perl -pe 's/([^\d\w\s])/"%".unpack("H2",$1)/ge' filename > filename.out

Eric Worrall

--
You have just received an Etech Solution
For all your Linux requirements contact

 
 
 

1. Tool to convert html file to ascii?

Hi,
Is there any tool to convert html files to simple ascii files?
Thanx,
Balaji
--
/-----------------------------------------------------------------------------\
| Balaji K.Raman      |                                                       |
| SR Research, Inc.   |145 D,Olde Derby Road                                  |
| Canton, MA 02021    |Norwood,MA 02062                                       |
| (617) 828-3200 x246 |(617) 551-3438                                         |

|-----------------------------------------------------------------------------|
| Life is like a play..It is not the time but the performance which counts!!  |
\-----------------------------------------------------------------------------/

2. rH 4.2 Installation

3. html forms and special characters

4. Error message in daily security output

5. converting an html file into a text file

6. Problem: Netscape cannot see any host?

7. How to convert text files to HTML files?

8. multiple Apache+JServ Servers

9. Converting text files to html files in HP-UX.

10. tool for converting manpages to html?

11. Problem with a non-special "special" character

12. \\\ Professional Images Virtual Domains/// Special Special Special Special

13. HTML Proxy which can convert html on the fly