The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-28-2009
jsfain jsfain is offline
Registered User
  
 

Join Date: Jun 2009
Location: New York, US area
Posts: 2
Question AWK for WURFL

Hi guys, first post here.

I want to work my way around the WURFL (xml) file and thought AWK would be a good scripting language.

Anyone done this, or used awk for XML parsing?
Or have other suggestions for a scripting language for this?

My interest in WURFL is to interrogate for specific types of device and capabilities.

Thanks.
  #2 (permalink)  
Old 06-28-2009
devtakh devtakh is offline
Registered User
  
 

Join Date: Oct 2007
Location: Bangalore
Posts: 514
Provide a sample input and the o/p for the sample input. We will be able to hep then.
  #3 (permalink)  
Old 06-28-2009
jsfain jsfain is offline
Registered User
  
 

Join Date: Jun 2009
Location: New York, US area
Posts: 2
OK.
There are around 11,000 devices in the wurfl. Here's an iPhone definition. Let's say I want to:

o Count all unique devices - device id and set of capability name's

<device id="apple_iphone_ver1" user_agent="Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A538a Safari/419.3" fall_back="apple_generic" actual_device_root="true">
<group id="product_info">
<capability name="mobile_browser" value="Safari"/>
<capability name="pointing_method" value="touchscreen"/>
<capability name="model_name" value="iPhone"/>
<capability name="device_os_version" value="1.0"/>
</group>
<group id="display">
<capability name="physical_screen_height" value="74"/>
<capability name="physical_screen_width" value="49"/>
<capability name="max_image_width" value="320"/>
<capability name="resolution_height" value="480"/>
<capability name="resolution_width" value="320"/>
<capability name="max_image_height" value="360"/>
</group>
<group id="object_download">
<capability name="wallpaper_max_height" value="480"/>
<capability name="wallpaper_max_width" value="320"/>
<capability name="wallpaper_preferred_width" value="320"/>
<capability name="wallpaper_preferred_height" value="480"/>
<capability name="video" value="true"/>
</group>
<group id="bearer">
<capability name="wifi" value="true"/>
<capability name="max_data_rate" value="200"/>
</group>
<group id="sound_format">
<capability name="aac" value="true"/>
<capability name="mp3" value="true"/>
</group>
<group id="xhtml_ui">
<capability name="accept_third_party_cookie" value="false"/>
<capability name="xhtml_send_mms_string" value="none"/>
<capability name="xhtml_send_sms_string" value="none"/>
<capability name="xhtml_honors_bgcolor" value="true"/>
<capability name="xhtml_file_upload" value="not_supported"/>
</group>
<group id="pdf">
<capability name="pdf_support" value="true"/>
</group>
<group id="rss">
<capability name="rss_support" value="true"/>
</group>
<group id="playback">
<capability name="playback_acodec_aac" value="lc"/>
<capability name="playback_mp4" value="true"/>
<capability name="playback_3gpp" value="true"/>
<capability name="playback_acodec_amr" value="nb"/>
<capability name="playback_mov" value="true"/>
<capability name="playback_vcodec_mpeg4_sp" value="0"/>
<capability name="playback_3g2" value="true"/>
<capability name="playback_vcodec_h263_0" value="-1"/>
<capability name="playback_vcodec_h264_bp" value="1.2"/>
</group>
<group id="streaming">
<capability name="streaming_acodec_aac" value="lc"/>
<capability name="streaming_real_media" value="none"/>
<capability name="streaming_3gpp" value="true"/>
<capability name="streaming_acodec_amr" value="nb"/>
<capability name="streaming_vcodec_mpeg4_sp" value="0"/>
<capability name="streaming_preferred_protocol" value="none"/>
</group>
<group id="deprecated">
<capability name="video_max_width" value="640"/>
<capability name="has_pointing_device" value="true"/>
<capability name="video_3gpp2" value="true"/>
<capability name="video_max_height" value="480"/>
<capability name="video_3gpp" value="true"/>
<capability name="video_mp4" value="true"/>
<capability name="video_preferred_width" value="320"/>
<capability name="video_preferred_height" value="240"/>
<capability name="video_max_frame_rate" value="30"/>
<capability name="video_wmv" value="false"/>
</group>
</device>

there are also records like the below and I'd like to strip off the sub version.

<device id="apple_iphone_ver1_sub3b48a_dede" user_agent="Mozilla/5.0 (iPhone; U; CPU like Mac OS X; de-de) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3B48b Safari/419.3" fall_back="apple_iphone_ver1"/>
<device id="apple_iphone_ver1_sub4a93_dede" user_agent="Mozilla/5.0 (iPhone; U; CPU like Mac OS X; de-de) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A93 Safari/419.3" fall_back="apple_iphone_ver1"/>
<device id="apple_iphone_ver1_subua_mysterious" user_agent="Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en)" fall_back="apple_iphone_ver1"/>
<device id="apple_iphone_ver1_sub1c28_en" user_agent="Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420 (KHTML, like Gecko) Version/3.0 Mobile/1C28 Safari/419.3" fall_back="apple_iphone_ver1"/>
<device id="apple_iphone_ver1_sub4a93_en" user_agent="Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A93 Safari/419.3" fall_back="apple_iphone_ver1"/>
<device id="apple_iphone_ver1_sub3a109a_es" user_agent="Mozilla/5.0 (iPhone; U; CPU like Mac OS X; es) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3A109a Safari/419.3" fall_back="apple_iphone_ver1"/>
<device id="apple_iphone_ver1_sub3a109a_fr" user_agent="Mozilla/5.0 (iPhone; U; CPU like Mac OS X; fr) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3A109a Safari/419.3" fall_back="apple_iphone_ver1"/>
<device id="apple_iphone_ver1_sub3a109a_itit" user_agent="Mozilla/5.0 (iPhone; U; CPU like Mac OS X; it-it) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3A109a Safari/419.3" fall_back="apple_iphone_ver1"/>
<device id="apple_iphone_ver1_sub3b48b_nlnl" user_agent="Mozilla/5.0 (iPhone; U; CPU like Mac OS X; nl-nl) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3B48b Safari/419.3" fall_back="apple_iphone_ver1"/>
<device id="apple_iphone_ver1_sub3a109a_plpl" user_agent="Mozilla/5.0 (iPhone; U; CPU like Mac OS X; pl-pl) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3A109a Safari/419.3" fall_back="apple_iphone_ver1"/>
<device id="apple_iphone_ver1_sub3b48b_ptpt" user_agent="Mozilla/5.0 (iPhone; U; CPU like Mac OS X; pt-pt) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3B48b Safari/419.3" fall_back="apple_iphone_ver1"/>


That's it - simple requests right? ;>)
Reply

Bookmarks

Tags
awk, wurfl

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:41 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0