Use sed
:
This is my string bere running the script
This is my string before running the script
This is my string befo running the script
This is my string before running the script
With a single regex (match before and everything after that and replace with nothing)
$ sed 's/before.*//' a
This is my string bere running the script
This is my string
This is my string befo running the script
This is my string
But maybe you want something like
sed 's/\ *before.*/\./' a
This is my string bere running the script
This is my string.
This is my string befo running the script
This is my string.
That removes eventual spaces before your word and add a dot.