I want to delete a string with parentesis an his contents, like this
(20.0 days)
sed -e 's/[0-9a-z]//g'
I can delete the numbers and the characters but I cant figure out how to get rid of the parentheses
sed 's/([^)]*)//g' file
will replace everything between ()
including the parantheses.
It matches (
, followed by any character until a closing )
then finally matches the closing )
.
The current pattern you have will remove more than just what's inside the parantheses. For example,
echo "(20.0 days) some text" | sed -e 's/[0-9a-z]//g'
will remove the some text
too.