#!/bin/bash
s=$(echo -e "some text\n\n\n some other text\n\n more text\n")
#echo "$s"
sed '/^$/d' <<< "$s"