如何将不同的SQL命令重定向到此文档中的不同文件

时间:2019-07-15 13:36:34

标签: shell redirect

我需要在此文档中运行两个SQL命令,并希望将第一个命令的结果重定向到文件“ A”,并将第二个命令的结果重定向到文件“ B”。到目前为止,这是我尝试过的:

su - omm -c "source /opt/Bigdata/mppdb/.mppdbgs_profile;gsql -d postgres -p 25308" << EOF
 select * from TB_MOVIL_CDR where scellidforfirstcellcalling_lo is null `1>/opt/gdsmigration/temp/missing_cellid_MOVIL.html`
 select * from TB_SMS_CDR where scellidforfirstcellcalling_lo is null `1>/opt/gdsmigration/temp/missing_cellid_SMS.html`
EOF

但是,我发现结果仍然打印在屏幕上。我知道“ 1> / opt / gdsmigration / temp /”会将标准输出重定向到文件,但是为什么仍将其输出在屏幕上?

0 个答案:

没有答案