tag=$1 for i in `find . -name \*.html -print` do echo $i sed -e :a -e "/<$tag"'$/N;s/\n/ /;ta' $i > $i.tmp mv $i.tmp $i done