gpt4 book ai didi

mysql - 在 bash 脚本中将 blob 从 mysql 导出到文件

转载 作者:行者123 更新时间:2023-11-29 14:43:45 24 4
gpt4 key购买 nike

我正在尝试编写一个 bash 脚本,该脚本除其他外,还可以从 mysql 数据库中提取信息。我尝试了以下方法从条目 20 中提取文件:
mysql -se“从 id=20 的表中选择文件列名;” >文件.txt

这给了我一个带有文件名的 file.txt,而不是文件内容。我如何将实际的 blob 放入 file.txt 中?

最佳答案

file.txt中的值转换为变量,然后根据需要使用它?即

blobFile=$(cat file.txt)
echo "----- contents of $blobFile ---------"
cat $blobFile
# copy the file somewhere else
scp $blobFile user@Remote /path/to/remote/loc/for/blobFile
# look for info in blobfile
grep specialInfo $blobFile
# etc ...

这是您想要/需要做的吗?

我希望这会有所帮助。

关于mysql - 在 bash 脚本中将 blob 从 mysql 导出到文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7446002/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com