#!/bin/bash
s="nie[breath]hi
hi </langenglish>'tjie"
sed 's/[[:space:]]*\([]>]\)[[:space:]]*/\1 /g;s/[[:space:]]*\([[<]\)[[:space:]]*/ \1/g' <<< "$s"