If I am doing several substitutions which need to be consecutive, e.g.sed -i '/^[[:space:]]*browser.*\.should/s/browser/expect(browser/' t1_spec.rbsed -i '/expect(browser.*\.should/s/\.should/).should/' t1_spec.rbsed -i 's/\.should/\.to/' t1_spec.rb sed -i 's/==/eq/' t1_spec.rb Is there a better way to do this that will only go through the t1_spec.file once and do the the 4 substitutions for each line rather than going through the file 4 times?
sed - how to do several consecutive substitutions but process file only once?
sed
In GNU (e.g. on my Ubuntu machine), simply using multiple lines is supported and  works well and looks good (imho) as it avoids super long lines, e.g.sed -i '/^[[:space:]]*browser.*\.should/s/browser/expect(browser/        /expect(browser.*\.should/s/\.should/).should/        s/\.should/\.to/        s/==/eq/' t1_spec.rb 