sed remove everything after last occurrence of character code example
Example: sed remove until first occurrence
echo remove_stay... | sed 's/.*\(stay.*\)/\1/g'
stay #remove all but from first ocurrence match until end
echo remove_stay... | sed 's/.*\(stay.*\)/\1/g'
stay #remove all but from first ocurrence match until end