Sponsored Content
Full Discussion: Selecting array values
Top Forums Programming Selecting array values Post 302495506 by shamrock on Thursday 10th of February 2011 12:24:48 PM
Old 02-10-2011
Are the two arrays sorted or do they need to be sorted...because if they need to be sorted then sorting is your solution otherwise yes it would be good not to have to loop throgh all the values.

---------- Post updated at 11:24 AM ---------- Previous update was at 11:21 AM ----------

One approach could be to find the midpoint of DIST and compare it to the end points of X and then move either left or right of the midpoint of DIST based on the result of the previous comparison.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Selecting Unique Values from many List

I have a question I have like 19 different list which contains the name of the server but what I need is just unique ones. First thing I need to do is just make a unique list within the list itself i.e. delete anything that is repeated inside the list like for example in list1 i... (1 Reply)
Discussion started by: pareshan
1 Replies

2. Shell Programming and Scripting

PHP: Search Multi-Dimensional(nested) array and export values of currenly worked on array.

Hi All, I'm writing a nagios check that will see if our ldap servers are in sync... I got the status data into a nested array, I would like to search key of each array and if "OK" is NOT present, echo other key=>values in the current array to a variable so...eg...let take the single array... (1 Reply)
Discussion started by: zeekblack
1 Replies

3. Shell Programming and Scripting

PERL - Selecting specific files based on 'date stamp' values

Hi, I've list of files in a directory, which have date stamp value in their names. ex: abc_data_20071102.csv, abc_data_20091221.csv, abc_data_20100110.csv, abc_data_20100222.csv, abc_data_20080620.csv,... etc., I need to select and process only files, within the given date... (4 Replies)
Discussion started by: ganapati
4 Replies

4. Shell Programming and Scripting

Selecting rows based on values in columns

Hi My pipe delimited .txt file contains rows with 10 columns. Can anyone advise how I output to file only those rows with the letters ‘ci' as the first 2 characters in the 3rd column ? Many thanks (4 Replies)
Discussion started by: malts18
4 Replies

5. Programming

selecting values of date

In a table, date is stored in a column as "2011-01-4". If I write query to get the dates > "2011-01-06" , then the date "2011-01-4" is also listed. The date stored in the column is a varchar datatype. So how can I make a query to not display the date "2011-01-4" ? Is there any solution ? Thank... (4 Replies)
Discussion started by: gameboy87
4 Replies

6. Shell Programming and Scripting

Help in selecting line numbers between two values

Hi! I've a file as shown below 1 hello 2 how 5 are 3 you 4 hello 5 world Every statement consists of line numbers at the beginning which are not in sequence. Now I want to select all the line numbers which are present between the line numbers specified by the user.. For example... (1 Reply)
Discussion started by: abk07
1 Replies

7. Shell Programming and Scripting

selecting record by matching in two columns values

Hi Guys ! i want to search a record in file by matching two values in a record in two different columns suppose i have 3 columns and i want to select all those values from col1 for which in col3 has a specific value e.g select all "john" from column1 where column 3 has a value of "20" ... (9 Replies)
Discussion started by: ourned
9 Replies

8. Shell Programming and Scripting

Selecting lowest and highest values in columns 1 and 2, based on subsets in column 3

Hi, I have a file with the following columns: 361459 447394 CHL1 290282 290282 CHL1 361459 447394 CHL1 361459 447394 CHL1 178352861 178363529 AGA 178352861 178363529 AGA 178363657 178363657 AGA Essentially, using CHL1 as an example. For any line that has CHL1 in... (2 Replies)
Discussion started by: hubleo
2 Replies

9. Shell Programming and Scripting

Selecting lines having same values for first two columns

Hello to all. This is first post. Kindly excuse me if I do not adhere to any rules and regulations of this forum. I have a file containing some rows with three columns each per row(separeted by a space). There are certain rows for which first two columns have same value but the value in... (6 Replies)
Discussion started by: manojmalhotra13
6 Replies

10. Shell Programming and Scripting

Help with shell script: selecting rows that have the same values in two columns

Hello, everyone I am beginner for shell programming. I want to print all lines that have the same values in first two columns data: a b 1 2 a a 3 4 b b 5 6 a b 4 6 what I expected is : a a 3 4 b b 5 6 but I searched for one hour in... (2 Replies)
Discussion started by: nengcheng
2 Replies
ptsematest(8)															     ptsematest(8)

NAME
ptsematest - Start two threads and measure the latency of interprocess communication with POSIX mutex. SYNTAX
ptsematest [-a|-a PROC] [-b USEC] [-d DIST] [-i INTV] [-l loops] [-p PRIO] [-t|-t NUM] DESCRIPTION
The program ptsematest starts two threads that are synchronized via pthread_mutex_unlock()/pthread_mutex_lock() and measures the latency between releasing and getting the lock. OPTIONS
-a, --affinity[=PROC] Run on procesor number PROC. If PROC is not specified, run on current processor. -b, --breaktrace=USEC Send break trace command when latency > USEC. This is a debugging option to control the latency tracer in the realtime preemption patch. It is useful to track down unexpected large latencies of a system. -d, --distance=DIST Set the distance of thread intervals in microseconds (default is 500 us). When cylictest is called with the -t option and more than one thread is created, then this distance value is added to the interval of the threads: Interval(thread N) = Interval(thread N-1) + DIST -i, --interval=INTV Set the base interval of the thread(s) in microseconds (default is 1000 us). This sets the interval of the first thread. See also -d. -l, --loops=LOOPS Set the number of loops. The default is 0 (endless). This option is useful for automated tests with a given number of test cycles. ptsematest is stopped once the number of timer intervals has been reached. -p, --prio=PRIO Set the priority of the process. -t, --threads[=NUM] Set the number of test threads (default is 1, if this option is not given). If NUM is specified, create NUM test threads. If NUM is not specifed, NUM is set to the number of available CPUs. EXAMPLES
The following example was running on a 4-way processor: # ptsematest -a -t -p99 -i100 -d25 -l1000000 #0: ID8672, P99, CPU0, I100; #1: ID8673, P99, CPU0, Cycles 1000000 #2: ID8674, P98, CPU1, I125; #3: ID8675, P98, CPU1, Cycles 811035 #4: ID8676, P97, CPU2, I150; #5: ID8677, P97, CPU2, Cycles 668130 #6: ID8678, P96, CPU3, I175; #7: ID8679, P96, CPU3, Cycles 589423 #1 -> #0, Min 1, Cur 1, Avg 2, Max 11 #3 -> #2, Min 1, Cur 2, Avg 2, Max 13 #5 -> #4, Min 1, Cur 4, Avg 3, Max 12 #7 -> #6, Min 1, Cur 4, Avg 2, Max 12 AUTHORS
Carsten Emde <C.Emde@osadl.org> SEE ALSO
pthread_mutex_lock(3p), pthread_mutex_unlock(3p) 0.1 ptsematest(8)
All times are GMT -4. The time now is 06:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy