shell - How to replace a sentence with space on the basis of a pattern if it occurs in the middle of a sentence -
suppose have line this:
aaaa ---- bbbb
i want erase ----bbbb
part, want keep aaaa
part in file. how can it?
using sed:
s='aaaa ---- bbbb' echo "$s"|sed 's/--* bb*/foo/' aaaa foo
Comments
Post a Comment