Last active
August 29, 2015 14:01
-
-
Save svieira/84026e5b9268f166df11 to your computer and use it in GitHub Desktop.
User-agent from the command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "parse-user-agent", | |
"version": "0.0.1", | |
"private": true, | |
dependencies: { | |
"platform": "~1.1.0", | |
"split": "~0.3.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env node | |
var platform = require('platform'); | |
process.stdin.pipe(require('split')()).on('data', function(line) { | |
var browserInfo = platform.parse(line); | |
if (browserInfo.version) { | |
console.log(browserInfo.name, "-", browserInfo.version.split(".")[0]); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
awk -F\" '{print $6}' your_combined_log | | |
./parse.js | | |
# Sort and print the user agents in descending order | |
sort | | |
uniq -c | | |
sort -g -k 1 -r | | |
less |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment