使用PowerShell分析CSV和可怜人的Web日志分析

本文介绍了如何使用PowerShell对CSV格式的日志文件进行分析,包括创建新的显示列,通过正则表达式提取文件编号,以及按显示降序排序和分组数据,以统计每个节目的下载次数。
摘要由CSDN通过智能技术生成

I was messing around with some log files for the podcast and exported a CSV. There's lots of ways for us to get stats, but I was just poking around.

我在处理播客的一些日志文件并导出了CSV。 我们有很多方法可以获取统计数据,但我只是在闲逛。

Given a CSV format like this:

给定这样的CSV格式:

"File","Hits","Bandwidth"
"/hanselminutes_0026_lo.wma","78173","163625808"
"/hanselminutes_0076_robert_pickering.wma","24626","-1789110063"
"/hanselminutes_0077.wma","17204","1959963618"
"/hanselminutes_0076_robert_pickering.mp3","15796","-55874279"
"/hanselminutes_0078.wma","14832","-1241370004"
"/hanselminutes_0075.mp3","13685","-1840937989"
"/hanselminutes_0075.wma","12129","1276597408"
"/hanselminutes_0078.mp3","11058","-1186433073"

“文件”,“命中”,“带宽” “ /hanselminutes_0026_lo.wma","78173","163625808” “ /hanselminutes_0076_robert_pickering.wma"、"24626"、"-1789110063” “ /hanselminutes_0077.wma","17204","1959963618” “ /hanselminutes_0076_robert_pickering.mp3"、"15796"、"-55874279” “ /hanselminutes_0078.wma"、"14832"、"-1241370004” “ /hanselminutes_0075.mp3","13685","-1840937989” “ /hanselminutes_0075.wma"、"12129"、"1276597408” “ /hanselminutes_0078.mp3","11058","-1186433073”

And noticing that there are different file extensions, but one logical show...for example there's an MP3 of Show 76 and WMA of that same show I wanted to find out how many downloads per show.

并注意到有不同的文件扩展名,但是一个逻辑的节目...例如,有一个Show 76的MP3和同一节目的WMA,我想找出每个节目有多少下载。

I fired up PowerShell. First I can bring in the CSV file and notice that it's parsed into a PowerShell object list nicely:

我启动了PowerShell。 首先,我可以引入CSV文件,并注意到它已经很好地解析为PowerShell对象列表:

PS C:\> import-csv File.csv | Select File,Hits

PS C:\> import-csv File.csv | 选择文件,命中

File                                                        Hits
----                                                        ----
/hanselminutes_0026_lo.wma                                  78173
/hanselminutes_0076_robert_pickering.wma                    24626
/hanselminutes_0077.wma                                     17204
/hanselminutes_0076_robert_pickering.mp3                    15796
/hanselminutes_0078.wma                                     14832
/hanselminutes_0075.mp3                                     13685
/hanselminutes_0075.wma                                     12129
/hanselminutes_0078.mp3                                     11058

文件点击---- ---- /hanselminutes_0026_lo.wma 78173 /hanselminutes_0076_robert_pickering.wma 24626 /hanselminutes_0077.wma 17204 /hanselminutes_0076_robert_pickering.mp3 15796 /hanselminutes_0078.wma 14832 /hanselminutes_0075.mp3 13685 /hanselminutes_0075.wma 12129 /hanselminutes_0078.mp3 11058

Notice that there are

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值