truncate to end of line after a specific string
I thought this would be easy to find on google or figure out myself. But either I am not looking properly or missing the obvious. Apologies in advance if this has been replied elsewhere.
I want to delete all characters to end of line after a specific string in a file.
So my file contents are such (with variable length lines)
The common string above starts with is '.hrpt <www-'
I want to delete everything and inclusive of the common string....so my output file would look like
I can easily do this using excel on a windows machine, but would like to try using shell scripting.
I played around a bit with sed command with little success.
Thanks much for any assistance.