Skip to content

Instantly share code, notes, and snippets.

@spuk-
Forked from franklinbr/bash
Last active May 14, 2019 19:22
Show Gist options
  • Save spuk-/b391d834d8f22daa49164bc4d7eb3bb8 to your computer and use it in GitHub Desktop.
Save spuk-/b391d834d8f22daa49164bc4d7eb3bb8 to your computer and use it in GitHub Desktop.
#!/bin/bash
arquivo_entrada='script.sql'
arquivo_tmp='temporario.sql'
arquivo_saida='saida.sql'
cp "$arquivo_entrada" "$arquivo_saida" && sed -e "2,\${`head -n1 "$arquivo_entrada" | sed -r -e 's/, /\n/g' | while read var x val; do echo -n "s/$var\\>/$val/g;"; done`}" "$arquivo_saida"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment