Reputation: 27231
sed 's/^\(\h*\)\(.*\)$/\1<!-- \2 -->/' web.xml
I think that this should take this xml:
<a>
<d>
bla
</d>
</a>
And turn it into:
<!-- <a> -->
<!-- <d> -->
<!-- bla -->
<!-- </d> -->
<!-- </a> -->
But what is doing is this:
<!-- <a> -->
<!-- <d> -->
<!-- bla -->
<!-- </d> -->
<!-- </a> -->
Upvotes: 2
Views: 795
Reputation: 91349
Use [ \t]*
instead of \h*
, like so:
sed 's/^\([ \t]*\)\(.*\)$/\1<!-- \2 -->/' web.xml
Here's a list of sed's escape (meta) characters.
Upvotes: 1