Reputation: 1823
I have certain data like following.
<some-thing>my-data<some-thing>
I would like to search a character '<' and remove till '>' and need a output like following.
my-data
Is there a way to do it with sed?
Upvotes: 0
Views: 120
Reputation: 41460
This awk
should do it:
echo "<some-thing>my-data<some-thing>" | awk '{gsub(/<[^>]*>/, " ");$1=$1}1'
my-data
Upvotes: 0
Reputation: 10039
if there is no < and > in your data
sed 's/<[^>]*>//g
if < or > could appear in the data content
sed 's/^<[^>]*>\(.*\)<[^>]*>$/\1/'
assuming that any line having tag < > are in the case.
remark: Often tag start with a <tag>
and stop with a </tag>
Upvotes: 0