I want to globally replace the string foo with the string bar, using sed. This should only be done for lines which do NOT start with the string ##Input.
I can\'t get
You just need to negate the match using !:
!
sed -i '/^##Input/! s/foo/bar/g' myfile