在下面我试图grep所有geoIs的模式。我的问题是我如何列出geoIs的不同值及其计数
前任:
GeoIs:"Paramount","sumthing else"
GeoIs:"undefined","sumthing else"
GeoIs:"undefined","sumthing else"
GeoIs:"178","sumthing else"
GeoIs:"178","sumthing else"
and many more
...
...
预期结果:
GeoIs:"Paramount" 1
GeoIs:"undefined" 2
GeoIs:"178" 2
命令
zcat file.gz | grep -P '"geoIs":".*?.undefined*?"' | sort -u -T.|wc -l
编辑1:
在以下字符串中找到 GEOIS
012-10-02 09:32:45{"e":{"ec":100001,"st":1349170352455,"bd":"Mozilla%2F5.0%20(Windows%20NT%206.1)%20AppleWebKit%2F537.4%20(KHTMf01f02008592~rt%2366.657~rv%2366.228~as%2317~st%231349170293955~cat%231349170352431~sp%23as~c%2334~pat%231349128562942","smplCookie":"undefined","geoIPAddress":"122.107.154.58","geoCountry":"australia","geoCity":"Vermont","geoRegion":"Victoria","geoPostalCode":"undefined","geoLatitude":"undefined","geoLongitude":"undefined","geoMetro":"0","geoArea":"0","geoIs"}}