Skip to content

Instantly share code, notes, and snippets.

@metaskills
Last active May 10, 2020 13:08
Show Gist options
  • Save metaskills/698a5139a79bbdaddcc84626f35de7ec to your computer and use it in GitHub Desktop.
Save metaskills/698a5139a79bbdaddcc84626f35de7ec to your computer and use it in GitHub Desktop.
Learning to Program The Cloud
insert_file_over_pattern () {
dline=$(sed -n "/${2}/=" $1)
rline=$(expr $dline - 1)
sed --in-place -e "${dline}d" $1
sed --in-place "${rline}r ../inserts/${1}" $1
}
insert_file_over_pattern 'config/application.rb' 'Bundler.require'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment