I found this command, sed -e 's/<[^>]*>//g', will return the content of a line with pattern something like this, <tag1>content</tag1>..
How does this works?
What does sed -e 's/<[^>]*>//g' actually do?
What if I wanted to get content of a line with pattern something like this, [tag2]content[/tag2]?
thanks..
is a search and replace pattern. In your example, there's no replace, and nothing will be returned.
You could use something like
sed -e 's/<\([^>]*\)>/\1/g'
to capture what's between the literal <>'s and return it.
The way that works: it could be read "find a literal < followed by 0 or more characters that are not a >, followed by a literal >, capturing the non-'>' characters and replacing the entire match with what is captured, for all instances (the meaning of the g at the end)