#Remove everything between and including () and replace the original file with that content sed -i '' "s/([^)]*)//g" #Remove control characters and colour codes from script output sed -i -e 's/\x1b\[.\{1,5\}m//g'