wine@localhost]$ sed 's/\(a\)[^\1]*\1/check/g' abbbba abbbbbbbba check