Mysql从管道导入 [英] Mysqlimport from pipe
问题描述
我试图弄清楚如何在没有运气的情况下将输出通过管道导入mysqlimport.我有一个很大的文件(〜250 GB),我想在处理它后通过管道将其导入mysqlimport.我不想创建中间文件/表.我在想像这样的东西:
猫基因组.mpileup | nawk'sub("^ ...",")'| mysqlimport -uuser -ppassword数据库但是显然这是行不通的.有关如何实现此目标的任何建议?
看起来mysqlimport不能从STDIN读取,但是您也许可以尝试使用扩展名来执行命令而不是文件
mysqlimport -uuser -ppassword Database <(cat genome | nawk)
I'm trying to figure out how to pipe output into mysqlimport without any luck. I have a huge file (~250 GB) that I want to pipe to mysqlimport after processing it. I don't want to create an intermediate file/table. I'm imagining something like this:
cat genome.mpileup | nawk 'sub("^...","")' | mysqlimport -uuser -ppassword Database
But obviously this isn't working. Any suggestions on how to accomplish this?
It doesn't look like mysqlimport can read from STDIN but you can perhaps experiment with a named pipe. Something like this (untested)
mkfifo bigfile
mysqlimport -uuser -ppassword Database bigfile &
cat genome | nawk > bigfile
Or you can use an extension to bash to run commands instead of files
mysqlimport -uuser -ppassword Database <(cat genome | nawk)
这篇关于Mysql从管道导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!