Skip to content

Instantly share code, notes, and snippets.

@djeikyb
Created January 28, 2021 00:01
Show Gist options
  • Save djeikyb/d726d93b6d8ab6b4e3ee7ac3095d1d31 to your computer and use it in GitHub Desktop.
Save djeikyb/d726d93b6d8ab6b4e3ee7ac3095d1d31 to your computer and use it in GitHub Desktop.
perl oneliner: insert line at beginning of a bunch of files
for f in tables/*.sql; do echo "$f"; perl -0777 -pi -e 's/^/use my_database_name;\n\n/' "$f"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment