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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
help need for pattern matching HIMANI UNIX for Dummies Questions & Answers 10 01-22-2008 04:30 AM
pattern matching in an if-then lumix Shell Programming and Scripting 4 12-14-2007 01:25 PM
pattern-matching in if-condition nymus7 Shell Programming and Scripting 6 07-19-2006 12:02 PM
Pattern matching sed leemjesse Shell Programming and Scripting 3 03-23-2005 01:06 AM
Pattern Matching danhodges99 UNIX for Dummies Questions & Answers 2 02-27-2003 12:03 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 12-20-2005
Registered User
 

Join Date: Dec 2005
Posts: 4
Pattern-Matching in If-Condition

Hey Guys,

I'm fighting with a particular pattern match today (ksh)... I need your help!

Middle in my script I read a variable A's value. This value could have three differents form:
1) the NumClicks is the number of clicks user makes during session.
2) the MeanRate is the average number of seconds between each click
3) the SDRate is the standard deviation (n-1) of the seconds between each click (my theory is individual sessions might have evenly spaced clicks -> smaller standard deviations than other sessions).

Some other variable must be read only if variable A is "x". For that I choose a if-condition without success:

Code:
if [ $A = "x" ] or if [ $A = "x" ]
if [ $A = "x" ] or if [ $A = "x" ]
My goal is to try and see if I can find un-discovered sessions by comparing file "x" to file "y" and creating new rules/conditions to find better patterns. Keep in mind my data files are too large to grok by merely looking at them; therefore, i'm using some nice commands to cut out some columns and sort stuff out. Thanks in advance guys
Reply With Quote
Forum Sponsor
  #2  
Old 12-20-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
not sure what you're asking here, but....
Code:
#!/bin/ksh

typeset -i a=5
typeset -i b=15

if (( a == 5 || b == 10 )); then
   echo 'match'
else
   echo 'no match'
fi
Reply With Quote
  #3  
Old 12-20-2005
Registered User
 

Join Date: Dec 2005
Posts: 4
Quote:
Originally Posted by vgersh99
not sure what you're asking here, but....
Code:
#!/bin/ksh

typeset -i a=5
typeset -i b=15

if (( a == 5 || b == 10 )); then
   echo 'match'
else
   echo 'no match'
fi
Thanks vgersh99,

Perhaps I can be more specific here. I am trying to distinguish "robot" sessions from "real user" sessions via raw access logs. After cleaning up the logs I assign an ID to each session. I then sort the rows in the log files to group all the rows for the same session together, and assign a session sequence number to each row. The results is a sequenced type url file. This file is the input to my robot detection routine, along with a few other downstream processes. Ultimately I am trying to see if I can find ANY undiscovered robot sessions from the output of these files...hence I feel pattern matching is the best fit for me here.
Reply With Quote
  #4  
Old 12-20-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
ok. and the question is..... ?
Reply With Quote
  #5  
Old 12-20-2005
Registered User
 

Join Date: Dec 2005
Posts: 4
Quote:
Originally Posted by vgersh99
ok. and the question is..... ?
Do you think I have have sufficient data above to find unique patterns between bots and users or have I missed something? If so, do you have any ideas for additional rules and/or conditions? Thanks
Reply With Quote
  #6  
Old 12-20-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
to be honest with you..... I have no idea what the definitions for 'bots' and 'users' are - this is all too application specific. If you have sample data files/records you would be the best person to identify the consistent patterns based on your knowledge of what you're doing and the objective.

Once you do that it becomes "a simple matter of implementation".
Reply With Quote
  #7  
Old 12-20-2005
Registered User
 

Join Date: Dec 2005
Posts: 4
Quote:
Originally Posted by vgersh99
to be honest with you..... I have no idea what the definitions for 'bots' and 'users' are - this is all too application specific. If you have sample data files/records you would be the best person to identify the consistent patterns based on your knowledge of what you're doing and the objective.

Once you do that it becomes "a simple matter of implementation".
thank you for your time
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:14 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0