具体来说(https://github.com/mikefarah/yq)4.35+我有一个以逗号分隔的术语字符串,并且如果字段值是其中一个术语,我想过滤列表。例如)给定以下输入:-
具体来说 https://github.com/mikefarah/yq https://github.com/mikefarah/yq)4.35+
我有一个以逗号分隔的术语字符串,如果字段值是这些术语之一,我想过滤列表。
例如)给定以下输入:
- name: bob
age: 12
- name: jen
age: 22
- name: mork
age: 4003
字段值作为子字符串存在的 name
元素 "jen,mork"
使得输出为:
- name: jen
age: 22
- name: mork
age: 4003
我还可以将这些术语表示为字符串数组,即 ["jen", "mork"]
因此相当于:
yq 'filter("jen,mork" | contains(.name))' array.yaml
# Though I'm not sure how `contains` gets the original array context
# or
yq 'filter(.name in ["jen", "mork"])' array.yaml
我意识到这可以通过构建一个集合来完成 or
,如下所示:
yq 'filter(.name == "jen" or .name == "mork"])' array.yaml
但我希望得到一些更优雅的东西。
我不太确定该尝试什么,因为这似乎与操作员想要的工作方式背道而驰。
将 Azure blob 内容复制到具有特定结构的本地服务器
您可以使用 Azcopy
工具将 Azure Blob 内容复制到具有特定结构的本地服务器来实现此目的。
命令如下:
azcopy copy "https://venkat326123.blob.core.windows.net/prod/backup/node1/*?<Your-sas-token>" "C:\backup\cluster" --recursive=true
azcopy copy "https://venkat326123.blob.core.windows.net/prod/backup/node2/results/forests/*?<Your-sas-token>" "C:\backup\cluster\forests" --recursive=true
azcopy copy "https://venkat326123.blob.core.windows.net/prod/backup/node3/example/forests/*?<Your-sas-token>" "C:\backup\cluster\forests" --recursive=true
命令和输出:
PS C:\Users\xxxx> azcopy copy "https://venkat326123.blob.core.windows.net/prod/backup/node1/*?<Your-sas-token>" "C:\backup\cluster" --recursive=true
INFO: Scanning...
INFO: azcopy.exe 10.22.2: A newer version 10.25.1 is available to download
INFO: Any empty folders will not be processed, because source and/or destination doesn't have full folder support
Job ea769875-1zzzd3e0c7ef4 has started
Log file is located at: C:\Users\zzzz.azcopy\ea7698xxx-884d-5166-71ad3e0c7ef4.log
100.0 %, 3 Done, 0 Failed, 0 Pending, 0 Skipped, 3 Total, 2-sec Throughput (Mb/s): 0.0633
Job ea769875-15zzzzsummary
Elapsed Time (Minutes): 0.0334
Number of File Transfers: 3
Number of Folder Property Transfers: 0
Number of Symlink Transfers: 0
Total Number of Transfers: 3
Number of File Transfers Completed: 3
Number of Folder Transfers Completed: 0
Number of File Transfers Failed: 0
Number of Folder Transfers Failed: 0
Number of File Transfers Skipped: 0
Number of Folder Transfers Skipped: 0
TotalBytesTransferred: 15823
Final Job Status: Completed
PS C:\Users\zzzz> azcopy copy "https://venkat326123.blob.core.windows.net/prod/backup/node2/results/forests/*?<Your-sas-token>" "C:\backup\cluster\forests" --recursive=true
INFO: Scanning...
INFO: azcopy.exe 10.22.2: A newer version 10.25.1 is available to download
INFO: Any empty folders will not be processed, because source and/or destination doesn't have full folder support
Job 3b63fezzzzz9c50ce has started
Log file is located at: C:\Users\zzz\.azcopy\3b63xxxxxf-0445-4e19-c116a29c50ce.log
100.0 %, 4 Done, 0 Failed, 0 Pending, 0 Skipped, 4 Total, 2-sec Throughput (Mb/s): 0.0396
Job 3b63fe9d-czzz29c50ce summary
Elapsed Time (Minutes): 0.0335
Number of File Transfers: 4
Number of Folder Property Transfers: 0
Number of Symlink Transfers: 0
Total Number of Transfers: 4
Number of File Transfers Completed: 4
Number of Folder Transfers Completed: 0
Number of File Transfers Failed: 0
Number of Folder Transfers Failed: 0
Number of File Transfers Skipped: 0
Number of Folder Transfers Skipped: 0
TotalBytesTransferred: 9940
Final Job Status: Completed
PS C:\Users\zzz> azcopy copy "https://venkat326123.blob.core.windows.net/prod/backup/node3/example/forests/*?<Your-sas-token>" "C:\backup\cluster\forests" --recursive=true
INFO: Scanning...
INFO: azcopy.exe 10.22.2: A newer version 10.25.1 is available to download
INFO: Any empty folders will not be processed, because source and/or destination doesn't have full folder support
Job 176d8769-bec9-184zzzc9 has started
Log file is located at: C:\Users\zzzzu\.azcopy\176zzec9-1846-zz.log
100.0 %, 3 Done, 0 Failed, 0 Pending, 0 Skipped, 3 Total, 2-sec Throughput (Mb/s): 0.5394
Job 176d8769zzcf46a460c9 summary
Elapsed Time (Minutes): 0.0336
Number of File Transfers: 3
Number of Folder Property Transfers: 0
Number of Symlink Transfers: 0
Total Number of Transfers: 3
Number of File Transfers Completed: 3
Number of Folder Transfers Completed: 0
Number of File Transfers Failed: 0
Number of Folder Transfers Failed: 0
Number of File Transfers Skipped: 0
Number of Folder Transfers Skipped: 0
TotalBytesTransferred: 135843
Final Job Status: Completed
在 Cluster 文件夹中:
在森林文件夹中: