#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' #Insert tab at beginning of lines. #Useful in output is going in to a job spec sed -i 's/^/\t\t/'