#!/bin/bash
if [ $# -eq 0 ]
then
echo "Download and extract the latest wurfl.xml from http://sourceforge.net/projects/wurfl/files/WURFL/"
echo "then use this script to extract the wireless user agent strings."
echo ""
echo "usage: wurfltxt wurfl.xml"
exit 1
fi
if [ ! -f "$1" ]
then
echo "the first argument must be a valid path to wurfl.xml"
exit 1
fi
grep user_agent $1 > wurfl.txt
sed 's/.*user_agent="//g' wurfl.txt > wurfl2.txt
sed 's/"\ fall_back.*//g' wurfl2.txt > wurfl.txt
rm wurfl2.txt
sort wurfl.txt > wurfl_sorted.txt
rm wurfl.txt
mv wurfl_sorted.txt wurfl.txt
echo Created wurfl.txt
Save that to a file called wurfltxt and then:
chmod +x wurfltxt
wurfltxt /path/to/wurfl.xml
and it will generate a wurfl.txt file containing just the complete WURFL list of mobile device user-agents.
No comments:
Post a Comment