#!/bin/bashs='foo-bar-foo[Foo - Bar]'sed -E ':a; s/^([^[-]+)-/\1/; ta' <<< "$s"
Standard input is empty
foobarfoo[Foo - Bar]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!