Reputation: 107
I have a file that looks like this:
[hello] - one
[hello] - two
[hello] - three
[hello] - four
I want to delete the '[hello] -' in every line so it will give me
one
two
three
four
Upvotes: 0
Views: 35
Reputation: 77105
I would go with cut
, but here are some other options:
With awk
:
$ awk -F' *- *' '{ print $NF }' << EOF
> [hello] - one
> [hello] - two
> [hello] - three
> [hello] - four
> EOF
one
two
three
four
With sed
:
$ sed 's/^\[hello\] - //' << EOF
> [hello] - one
> [hello] - two
> [hello] - three
> [hello] - four
> EOF
one
two
three
four
Upvotes: 0