I'm an trying to pipe output data directly from sed into mysql by doing something like:
sed "s/url\/uct\/video/url\/uct\/video/g" 2019-11-25T0330-main.sql.gz | mysql opencast
Is this possible? I keep running out of space and therefore piping it straight into mysql would be ideal (instead of running sed independently).
You need
gunzip main.sql.gz | sed 's@url/uct/video@url/uct/video@g' | mysql opencast
Note if you use a different char besides /
for sed
s s/str/rep/
you can avoid having to escape /
chars that are part of the sub/repl
patterns. For some OS's (besided Linux) users, you may need to escape the first use of the alternate delimit character, like sed '\@sub@repl@
And if you are using the -i
option for sed
, it doesn't make sense in the context of reading input from a pipe ;-)
IHTH
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With