Sponsored Content
Top Forums Shell Programming and Scripting Pattern-Matching in If-Condition Post 93604 by jzillan on Tuesday 20th of December 2005 04:33:00 PM
Old 12-20-2005
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.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

comment/delete a particular pattern starting from second line of the matching pattern

Hi, I have file 1.txt with following entries as shown: 0152364|134444|10.20.30.40|015236433 0233654|122555|10.20.30.50|023365433 ** ** ** In file 2.txt I have the following entries as shown: 0152364|134444|10.20.30.40|015236433 0233654|122555|10.20.30.50|023365433... (4 Replies)
Discussion started by: imas
4 Replies

2. Shell Programming and Scripting

counting the lines matching a pattern, in between two pattern, and generate a tab

Hi all, I'm looking for some help. I have a file (very long) that is organized like below: >Cluster 0 0 283nt, >01_FRYJ6ZM12HMXZS... at +/99% 1 279nt, >01_FRYJ6ZM12HN12A... at +/99% 2 281nt, >01_FRYJ6ZM12HM4TS... at +/99% 3 283nt, >01_FRYJ6ZM12HM946... at +/99% 4 279nt,... (4 Replies)
Discussion started by: d.chauliac
4 Replies

3. UNIX for Dummies Questions & Answers

csh, pattern matching in if() condition.

Hi: I am struggling to get the simplest pattern matching to work, in csh. In this line: if ("$MY" =~ /my/) echo match it seems that I just can not make it to match, even when $MY is "mymymy". Thanks. N.B Phil ---------- Post updated at 11:23 PM ---------- Previous update... (0 Replies)
Discussion started by: phil518
0 Replies

4. Shell Programming and Scripting

matching patterns inside a condition in awk

I have the following in an awk script. I want to do them on condition that: fext == "xt" FNR == NR { />/ && idx = ++i $2 || val = $1 next } FNR in idx { v = val] } { !/>/ && srdist = abs($1 - v) } />/ || NF == 2 && srdist < dsrmx {... (1 Reply)
Discussion started by: kristinu
1 Replies

5. Shell Programming and Scripting

multiple condition matching and doing some predefined work

Hi everybody, I had 10 files in in one folder(/home/sai/) namely sai. 1.gz,2.gz,3.gz ..,10.gz. I want to delete the files which are there home based on the following conditions fliecount in sai folder==10 && grep -cv ".gz"==0 How to check this using awk? Otherwise please... (2 Replies)
Discussion started by: p_sai_ias
2 Replies

6. Shell Programming and Scripting

If condition matching with special chars

Hi, I have file #cat drivers.txt fcs0 fcs1 vscsi1 vscsi2 In this i need to check the availabality of "fcs" or "vscsi" alone not vscsi0,fcs1 I tried with "if condition" but it is not working. cat drivers.txt| while read ADAP do echo "Checking for $ADAP" if ;then echo "FC... (9 Replies)
Discussion started by: ksgnathan
9 Replies

7. UNIX for Dummies Questions & Answers

Find pattern suffix matching pattern

Hi, I am trying to get a result out of this but fails please help. Have two files /tmp/1 & /tmp/hosts. /tmp/1 IP=123.456.789.01 WAS_HOSTNAME=abcdefgh.was.tb.dsdc /tmp/hosts 123.456.789.01 I want this result in /tmp/hosts if hostname is already there dont want duplicate entry. ... (5 Replies)
Discussion started by: rajeshwebspere
5 Replies

8. Shell Programming and Scripting

Sed: printing lines AFTER pattern matching EXCLUDING the line containing the pattern

'Hi I'm using the following code to extract the lines(and redirect them to a txt file) after the pattern match. But the output is inclusive of the line with pattern match. Which option is to be used to exclude the line containing the pattern? sed -n '/Conn.*User/,$p' > consumers.txt (11 Replies)
Discussion started by: essem
11 Replies

9. Shell Programming and Scripting

PHP - Regex for matching string containing pattern but without pattern itself

The sample file: dept1: user1,user2,user3 dept2: user4,user5,user6 dept3: user7,user8,user9 I want to match by '/^dept2.*/' but don't want to have substring 'dept2:' in output. How to compose such regex? (8 Replies)
Discussion started by: urello
8 Replies

10. UNIX for Dummies Questions & Answers

Grep -v lines starting with pattern 1 and not matching pattern 2

Hi all! Thanks for taking the time to view this! I want to grep out all lines of a file that starts with pattern 1 but also does not match with the second pattern. Example: Drink a soda Eat a banana Eat multiple bananas Drink an apple juice Eat an apple Eat multiple apples I... (8 Replies)
Discussion started by: demmel
8 Replies
SSL_CTX_sess_set_cache_size(3)					      OpenSSL					    SSL_CTX_sess_set_cache_size(3)

NAME
SSL_CTX_sess_set_cache_size, SSL_CTX_sess_get_cache_size - manipulate session cache size LIBRARY
libcrypto, -lcrypto SYNOPSIS
#include <openssl/ssl.h> long SSL_CTX_sess_set_cache_size(SSL_CTX *ctx, long t); long SSL_CTX_sess_get_cache_size(SSL_CTX *ctx); DESCRIPTION
SSL_CTX_sess_set_cache_size() sets the size of the internal session cache of context ctx to t. SSL_CTX_sess_get_cache_size() returns the currently valid session cache size. NOTES
The internal session cache size is SSL_SESSION_CACHE_MAX_SIZE_DEFAULT, currently 1024*20, so that up to 20000 sessions can be held. This size can be modified using the SSL_CTX_sess_set_cache_size() call. A special case is the size 0, which is used for unlimited size. When the maximum number of sessions is reached, no more new sessions are added to the cache. New space may be added by calling SSL_CTX_flush_sessions(3) to remove expired sessions. If the size of the session cache is reduced and more sessions are already in the session cache, old session will be removed at the next time a session shall be added. This removal is not synchronized with the expiration of sessions. RETURN VALUES
SSL_CTX_sess_set_cache_size() returns the previously valid size. SSL_CTX_sess_get_cache_size() returns the currently valid size. SEE ALSO
ssl(3), SSL_CTX_set_session_cache_mode(3), SSL_CTX_sess_number(3), SSL_CTX_flush_sessions(3) 1.0.1i 2009-07-20 SSL_CTX_sess_set_cache_size(3)
All times are GMT -4. The time now is 05:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy