I want to extract the first sentence of a file in bash. I used the following command:
sed 's/(\?|\.|!).*//' filename
However, it does not work. What is wrong with my regex?
If I have the following sentence in the file: Stack overflow is the best? I am also the best.
, the output needs to be Stack overflow is the best?
Note: the question mark needs to be there at the end. Also the sentence may end with full stop / question mark / exclamation mark.
Edit: The sentence might contain words like Mr.
etc