summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/get-user-agent.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/bin/get-user-agent.sh b/bin/get-user-agent.sh
new file mode 100755
index 0000000..4d348d9
--- /dev/null
+++ b/bin/get-user-agent.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+ACCESSLOG="$1"
+PATTERN="$2"
+OUTPUT="$3"
+LINE=`grep "$PATTERN" "$ACCESSLOG" | grep Chrome | tail -n 1`
+if [ -n "$LINE" ]
+then
+ COLS=`echo "$LINE" | csvtool -t ' ' width -`
+ echo "$LINE" | csvtool -t ' ' col $COLS - | sed 's/"//g' > $OUTPUT
+fi