如何在 Unix 中管理报告/文件分发到不同的目的地?
报告工具将在文件系统(Unix 目录)中生成大量报告/文件。有一个目的地列表(电子邮件地址和共享文件夹),其中需要在每个目的地分发一组不同的报告/文件(可以重叠)。
我想知道是否有一种方法可以使用 shell 脚本有效地管理此报告交付,以便将来报告和目标列表的维护不会变得一团糟。
这是一个开放式问题,但限制是它应该在 Unix FS 中管理报告的范围内工作。
The reporting tools will generate a huge numbers of reports/files in the file system (a Unix directory). There's a list of destinations (email addresses and shared folders) where a different set of reports/files (can have overlap) are required to be distributed at each destinations.
Would like to know if there's a way to efficiently manage this reports delivery using shell scripts so that the maintenance of the list of reports and destinations will not become a mess in future.
It's quite an open ended question, the constraint however is that it should work within the boundaries of managing the reports in a Unix FS.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您始终可以创建一个简单的文本文件(此处为report_locations.txt),其中包含报告所在的名称/位置,即
报告名称将始终是此示例中的第一个字段以及相应报告应遵循的位置,以逗号(或任何您喜欢的其他分隔符)。
然后用 shell 脚本读取该文件(我喜欢使用
for
循环进行此类操作):for
循环的使用可能有点过多(我被抓住了),但它完成了工作。不确定这是否是您想要的,但它是一个起点(如果有的话)。如果您需要代码的任何解释,请随时询问。
You could always create a simple text file (report_locations.txt here) with names/locations where reports go i.e.
The report names will always be the first field in this example and locations where the corresponding reports should go follow, delimited by commas (or any other delimiter you like).
Then read that file with a shell script (I like to use
for
loops for this sort of operation):The use of
for
loops may be a bit excessive (I get caught up in them), but it gets the job done.Not sure this is what you would be looking for, but it is a starting point if anything. Don't hesitate to ask if you need any explanation of the code.