[PLUG] sed regex to strip html code

mikeraz at patch.com mikeraz at patch.com
Wed Jul 3 18:21:58 UTC 2002


since the angle brackets are part of an expression enclosed in single quotes 
you don't need to escape them.

Try just sed 's/<.*>//g' INFILE  > OUTFILE

On Wed, Jul 03, 2002 at 10:57:21AM -0700, Rich Shepard typed:
>   I'm trying to put together a one-line sed program that will strip html
> codes from a text file and leave the text behind. I've not yet succeeded.
> I've tried:  sed 's/\<.*\>//g' <filename> > <output_filename>
> and it extracts angle brackets but does not remove them from the file.
> Instead, it puts the extracted text into the output file.

-- 
    Michael Rasmussen  aka  mikeraz
   Be appropriate && Follow your curiosity

   "They that give up essential liberty to obtain
   temporary safety, deserve neither liberty nor safety."
				-- Benjamin Franklin 	

   and the fortune cookie says:
egrep patterns are full regular expressions; it uses a fast deterministic
algorithm that sometimes needs exponential space.
-- unix manuals




More information about the PLUG mailing list