I have a file that looks like this:
bar
barfo
barfoo
barfooo
barfoooo
sample
sampleText1
sampleText2
sampleText3
prefix
prefixFooBar
prefixBarFoo
What I want sed (or awk) to do is to remove the string which introduces a section, from all of its contents, so that I end up with:
bar
fo
foo
fooo
foooo
sample
Text1
Text2
Text3
prefix
FooBar
BarFoo
I tried using
sed -e -i '/([[:alpha:]]+)/,/^$/ s/\1//g' file
But that fails with "Invalid Backreference".