[ale] SED question

Pete Hardie pete.hardie at dvsg.sciatl.com
Tue Mar 19 13:53:02 EST 2002


Josh Freeman wrote:
> 
> Hello ALE'ers
> 
> I've got to batch process some HTML files, and I need to make
> substitutions of the form
> <h2> => foo
> </h2> => bar
> 
> The expression:
> 
> sed s/\<[hH]2\>/foo/g
> 
> takes care of the first one, but I have yet to get an expression to work
> for the second case, I would expect:
> 
> sed s/\<\\[hH]2\>/bar/g to return bar, but it returns <\h2> instead.
> 
> Any ideas. I assume that I am not escaping the '\' correctly, but I
> haven't an idea how to do it.

You're gonna kick yourself......

\\ escapes a backslash, but your pattern is </h2> (forward slash)

so s?\</[Hh]\>?bar?g should do it.....

-- 
Pete Hardie                   |   Goalie, DVSG Dart Team
    posting from, but not     |
	speaking for:             |
Scientific Atlanta, Digital Video Services Group


<html>
<body>
<font size="3" face="Times New Roman"><span style="mso-fareast-font-family: Times New Roman; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">
- - - - - - - Appended by Scientific-Atlanta, Inc. - - - - - - -
<span style="font-size:10.0pt;font-family:Times New Roman;
mso-fareast-font-family:&quot;Times New Roman&quot;;mso-ansi-language:EN-US;mso-fareast-language:
EN-US;mso-bidi-language:AR-SA"></span><font face="Times New Roman" size="3"><span style="mso-fareast-font-family:Times New Roman; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">This e-mail and any attachments may contain information which is confidential, proprietary, privileged or otherwise protected by law. The information is solely intended for the named addressee (or a person responsible for delivering it to the addressee). If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer.</span></font></p>
</body>
</html>


---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
sent to listmaster at ale dot org.






More information about the Ale mailing list