Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shell script: send sed output to mysql?

Tags:

bash

shell

mysql

Trying to pipe the output of a sed replacement on a text file into MySQL like so:

mysql -D WAR | sed -e "s/2000/$START/g" -e "s/2009/$END/g" < WAR.sql

That's not working. Nor is:

mysql -D WAR < sed -e "s/2000/$START/g" -e "s/2009/$END/g" < WAR.sql

What's the proper solution here?

like image 878
Wells Avatar asked Dec 14 '22 00:12

Wells


1 Answers

sed "s/2000/$START/g;s/2009/$END/g" WAR.sql | mysql -D WAR
like image 142
ghostdog74 Avatar answered Dec 29 '22 21:12

ghostdog74