# a little helper since sed on OSX does not have sed -i
# for in-place modifications. Note that filename here comes first
# just to ease scripting
sed-i () {
filename=$1
tfilename=$(mktemp -t sed_replace.XXXXXXXXX)
shift
sed "$@" "$filename" >| "$tfilename"
mv "$tfilename" "$filename"
}
here is what we did in https://github.com/ReproNim/simple_workflow/blob/b4ea4a902abd92852328f55a26eb45ab049d458c/Simple_Prep_docker#L19