我正在获取文件中的数据
vi file.txt
"https://uat.barclaysinvestments.com/en_JE/home/funds/funds-view.html?tab=fundDocuments&isin=GB0000790005"
"https://uat.barclaysinvestments.com/en_UK/home/funds/funds-view.html?tab=fundOverview&isin=GB0003208278"
"https://uat.barclaysinvestments.com/en_UK/home/funds/funds-view.html?tab=fundOverview&**isin**=GB0003208278"
"https://uat.barclaysinvestments.com/en_UK/home/funds/funds-view.html?**tab=fundPerformanc**e&isin=GB0003208278"
"https://uat.barclaysinvestments.com/en_UK/home/funds/funds-view.html?**tab=fundPerformance**&isin=GB0003208278"
"https://uat.barclaysinvestments.com/en_UK/home/funds/funds-view.html?tab=fundPerformance&isin=GB0003208278"
所以通过下面的命令我得到uniq的isin
sed -n -e "/isin/ s/.*\= *//p" file.txt|sort| uniq -c |sort -nr
但我希望在概览和性能等标签的基础上进一步聚合
所以我将了解特定isin的多少个标签访问。
答案 0 :(得分:0)
不够清楚,请你试试,如果这对你有所帮助,请告诉我。
awk '
{
match($0,/Performance|Overview/);
val=substr($0,RSTART,RLENGTH);
if(val){
array[val]++}
}
END{
for(i in array){
print i,array[i]}
}
' Input_file
输出如下:
Performance 2
Overview 2