echo remove_stay... | sed 's/.*(stay.*)/1/g' stay #remove all but from first ocurrence match until end