【发布时间】:2018-07-25 01:35:04
【问题描述】:
我是脚本新手。
我有以下三个文件:
Availability.json
Source URLs.txt
Target URLs.txt
我的要求是我需要搜索 Source URLs.txt 中存在的 URL,并将其替换为 Availability.json 文件中的 Target URLs.txt。
我们如何在 shell 脚本中实现这一点?我们有大约 50 个网址。
内容: 可用性.json
"drillDownUrl": "https://appdync-mex-cgn-2u.mex.group.net:8090/controller/#/location=METRIC_BROWSER&timeRange=last_30_minutes.BEFORE_NOW.-1.-1.180&application=1000&metrics=APPLICATION_COMPONENT.647.4743559",
"label": null,
"description": null,
"drillDownUrl": "https://appdync-mex-cpo-7u.mex.group.net:8090/controller/#/location=METRIC_BROWSER&timeRange=last_30_minutes.BEFORE_NOW.-1.-1.180&application=1&metrics=APPLICATION_COMPONENT.647.474",
Source_URLs.txt
https://appdync-mex-cgn-2u.mex.group.net:8090/controller/#/location=METRIC_BROWSER&timeRange=last_30_minutes.BEFORE_NOW.-1.-1.180&application=1000&metrics=APPLICATION_COMPONENT.647.4743559
https://appdync-mex-cpo-7u.mex.group.net:8090/controller/#/location=METRIC_BROWSER&timeRange=last_30_minutes.BEFORE_NOW.-1.-1.180&application=1&metrics=APPLICATION_COMPONENT.647.474
Target_URLs.txt:
https://www.apdyn.com/Application#=12
https://www.appdyn.com/Application#=123
【问题讨论】:
-
您需要稍微分解一下问题,并向我们展示其中一些文件中的内容。
-
在 json 文件中,我们有大约 50 个类似于 appdyn.net/Application=12/components=12345....In Source_URLs.txt 的 URL,我们有 json 中存在的所有 50 个 URL,在 Target_URLs.txt 我们有要替换的 URL...需要替换 Target_URLs 文件 injson 文件中的所有 50 个 URL...希望它有意义...
-
您需要展示您的 JSON 样本以及源 URL 和目标 URL 的示例。您在此处粘贴的链接无效。
-
你用的是什么外壳?重击?您是否需要它仅与您的外壳一起使用,或者您的目标是广泛兼容?最好在这里具体一点。
-
请阅读Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers? - 总结是这不是解决志愿者的理想方式,并且可能会适得其反。请不要将此添加到您的问题中。