Get content between a pair of HTML tags using Bash

Using sed in shell/bash, so you needn’t install something else.

tag=body
sed -n "/<$tag>/,/<\/$tag>/p" file

Leave a Comment