User Agents Identifier


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting User Agents Identifier
# 1  
Old 03-05-2015
User Agents Identifier

Hi,

Can anyone help me write a script tp determine the web browser from a user agent. A user agent is stored in a file and consists of hundreds of lines e.g.

Code:
 37050 Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
  29404 Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.93 Safari/537.36
  26072 Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko
  20606 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0
  20368 Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
  19264 Mozilla/5.0 (iPad; CPU OS 8_1_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B440 Safari/600.1.4
  16998 Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53
  14636 Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.94 Safari/537.36
  13223 Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.93 Safari/537.36
  12640 Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko
  12042 Mozilla/5.0 (iPhone; CPU iPhone OS 8_1_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B466 Safari/600.1.4
  11327 Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.93 Safari/537.36
  10691 Mozilla/5.0 (iPad; CPU OS 8_1_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B466 Safari/600.1.4
   9202 Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.94 Safari/537.36
   9159 Mozilla/5.0 (Windows NT 6.3; Win64; x64; Trident/7.0; rv:11.0) like Gecko
   8475 Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.94 Safari/537.36

Thankyou

C
# 2  
Old 03-05-2015
Which line do you want?
# 3  
Old 03-05-2015
I want to do a loop for each line
# 4  
Old 03-05-2015
Code:
while read LINE
do
         echo "Line is $LINE"
done < inputfile

# 5  
Old 03-05-2015
how do you input it into a field box in a web browser such as firefox, and then press search button?
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. Web Development

Discrepancies Between Our Mobile Detection Code and Google Analytics Regarding Chinese User Agents

Update: Last two days the number of users on the site has peaked (normally around 10AM US Eastern Time) between 4,300 and 4,500. This is the highest number of consistent concurrent users in at least 3 years. ... and the traffic continues to rise week-over-week. (5 Replies)
Discussion started by: Neo
5 Replies

2. Shell Programming and Scripting

Variable not an identifier when script is run as another user

I am new to scripting I keep getting the error var2= is not an identifier when I run this script as another user. BUT when I run it as myself, the script completes without error. Any idea why? I assume it is because the new user has a different environment . How do I make the variables active... (5 Replies)
Discussion started by: newbie2010
5 Replies

3. UNIX for Dummies Questions & Answers

Offline Agents Inquiry.

Hello, I currently use Solaris, and typically I use the svcs -a | grep PROCESS to see if it's online or Offline. My questions is SVCS is in solaris but if I want to find out if a daemon or process is offline what other methods can I use? ps -ef | grep PROCESS "what do I look for" or... (1 Reply)
Discussion started by: NelsonC
1 Replies

4. UNIX for Advanced & Expert Users

snmpdx (master agent) doens't relay messages to agents

Hi, I've installed on my Solaris 9 (sparc) the Solstice Enterprise Agents and I'm trying to register my application with the master agent of the Solaris, so when the master agent recieves an SNMP message with my O.I.D range, it forwards it to my application. My application listen on port... (2 Replies)
Discussion started by: ShaharP
2 Replies

5. Solaris

Agents for Auditing and Monitoring

Auditing and Monitoring is the most important activitiy of system administrator. In order to improve the servers administered per administrator, can anyone suggest some low cost ( preferably free ) tools/agents. (1 Reply)
Discussion started by: shauche
1 Replies
Login or Register to Ask a Question