Sponsored Content
Top Forums Shell Programming and Scripting Cleaning up Arrays with duplicate values Post 302439824 by divzz on Saturday 24th of July 2010 02:25:16 AM
Old 07-24-2010
Hi

you can place the two arrays in two files- file1 and file2.
Code:
cat file2 >> file1 
sort -nu file1


Last edited by radoulov; 07-24-2010 at 04:31 AM.. Reason: Code tags, please!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Concatenating arrays cell values in shell scripting

Hi All, I want to concatenate the array cell values and form a string.. Is it possible? for ex. I have an array word_array contains d u m b and after concatenating the string shld be 'dumb' thanks (2 Replies)
Discussion started by: mathur
2 Replies

2. Shell Programming and Scripting

storing values in arrays using shell

Friends, I have to execute a command and store its contents into an array using shell. this is what i have tried #!/bin/bash disk_names = ($(`iostat -xtc | egrep -v "device|nfs" | awk '{print $1}'| tr '\n' ' ' `)) But its throwing an error message as ./test-script ./test-script:... (6 Replies)
Discussion started by: achak01
6 Replies

3. Shell Programming and Scripting

Storing values in arrays using csh

I am reading a number of files but then I want to put the ranges xmin xmax ymin ymax as arrays for each file. Any idea how I can do this??? set j = 1 echo "Welcome $i times" while ( $j <= $i ) echo "$j" set fname = $fin-bst-misf.xy echo " "$fname ... (0 Replies)
Discussion started by: kristinu
0 Replies

4. Shell Programming and Scripting

Storing values in arrays

I have the following csh script which lets the use pass the following as an argument -legend=tag1/tag2/tag3/tag4/tag5/tag6/tag7 We pass a number of tags separated by '/'. I want to save the legend tags in an array and have done as below. How can I improve on this as things are getting quite... (3 Replies)
Discussion started by: kristinu
3 Replies

5. Shell Programming and Scripting

arrays and two values

I have requirement where I need to capture the highest values of items from a feed that runs for N hours. For example lets assume my data looks like this first feed ======== appples 10 oranges 20 pears 14 second feed ========== apples 5 oranges 30 pears 1 Last feed... (6 Replies)
Discussion started by: BeefStu
6 Replies

6. Shell Programming and Scripting

How do I find the sum of values from two arrays?

Hi I have redc containing the values 3, 6, 2, 8, and 1. I have work containing the values 8, 2, 11, 7, and 9. Is there a way to find the sum of redc and work? I need to compare the sum of those two arrays to something else, so is it okay to put that into my END? TY! (4 Replies)
Discussion started by: razrnaga
4 Replies

7. Shell Programming and Scripting

Using dynamic arrays to extract the values

Hi all, We have requirement to generate load timing based on subject areas HOUSEHOLD, BANKING and TRADING. These values are stored in an array SUB_ARR SUB_ARR=("HOUSEHOLD" "BANKING" "TRADING") Based on indicator files produced while processing data for each type, we need to get the stats (using... (2 Replies)
Discussion started by: sanjaydubey2006
2 Replies

8. Shell Programming and Scripting

Modifying the values of dynamically named arrays

Hi all, In ksh, I'm trying to loop through all of my arrays, named array1, array2, array3..., and update the indices. But I'm getting errors and I'm not sure how to fix them. The errors are ./parse.sh: 6+1: not found The code is: eval \${array$c}=$(eval \${array$c}+1 ) Any help... (12 Replies)
Discussion started by: nicksantos1
12 Replies

9. Shell Programming and Scripting

Compare two arrays by values [BASH]

I have 2 arrays of values for example A1 ={10 15 3 21} A2 ={10 15 3 22} I need to check which one has greater values. However: A1 ={10 15 3 21} A2 ={10 15 3 21 3} - this one would be greater. A1 ={10 15 5 21} - this one greater A2 ={10 15 3 21} Basically, I want to compare patch... (6 Replies)
Discussion started by: Jutsimitsu
6 Replies

10. Shell Programming and Scripting

Find duplicate values in specific column and delete all the duplicate values

Dear folks I have a map file of around 54K lines and some of the values in the second column have the same value and I want to find them and delete all of the same values. I looked over duplicate commands but my case is not to keep one of the duplicate values. I want to remove all of the same... (4 Replies)
Discussion started by: sajmar
4 Replies
Weak(3) 							   OCaml library							   Weak(3)

NAME
Weak - Arrays of weak pointers and hash tables of weak pointers. Module Module Weak Documentation Module Weak : sig end Arrays of weak pointers and hash tables of weak pointers. === Low-level functions === type 'a t The type of arrays of weak pointers (weak arrays). A weak pointer is a value that the garbage collector may erase whenever the value is not used any more (through normal pointers) by the program. Note that finalisation functions are run after the weak pointers are erased. A weak pointer is said to be full if it points to a value, empty if the value was erased by the GC. Notes: -Integers are not allocated and cannot be stored in weak arrays. -Weak arrays cannot be marshaled using Pervasives.output_value nor the functions of the Marshal module. val create : int -> 'a t Weak.create n returns a new weak array of length n . All the pointers are initially empty. Raise Invalid_argument if n is negative or greater than Sys.max_array_length -1 . val length : 'a t -> int Weak.length ar returns the length (number of elements) of ar . val set : 'a t -> int -> 'a option -> unit Weak.set ar n (Some el) sets the n th cell of ar to be a (full) pointer to el ; Weak.set ar n None sets the n th cell of ar to empty. Raise Invalid_argument Weak.set if n is not in the range 0 to Weak.length a - 1 . val get : 'a t -> int -> 'a option Weak.get ar n returns None if the n th cell of ar is empty, Some x (where x is the value) if it is full. Raise Invalid_argument Weak.get if n is not in the range 0 to Weak.length a - 1 . val get_copy : 'a t -> int -> 'a option Weak.get_copy ar n returns None if the n th cell of ar is empty, Some x (where x is a (shallow) copy of the value) if it is full. In addi- tion to pitfalls with mutable values, the interesting difference with get is that get_copy does not prevent the incremental GC from erasing the value in its current cycle ( get may delay the erasure to the next GC cycle). Raise Invalid_argument Weak.get if n is not in the range 0 to Weak.length a - 1 . val check : 'a t -> int -> bool Weak.check ar n returns true if the n th cell of ar is full, false if it is empty. Note that even if Weak.check ar n returns true , a sub- sequent Weak.get ar n can return None . val fill : 'a t -> int -> int -> 'a option -> unit Weak.fill ar ofs len el sets to el all pointers of ar from ofs to ofs + len - 1 . Raise Invalid_argument Weak.fill if ofs and len do not designate a valid subarray of a . val blit : 'a t -> int -> 'a t -> int -> int -> unit Weak.blit ar1 off1 ar2 off2 len copies len weak pointers from ar1 (starting at off1 ) to ar2 (starting at off2 ). It works correctly even if ar1 and ar2 are the same. Raise Invalid_argument Weak.blit if off1 and len do not designate a valid subarray of ar1 , or if off2 and len do not designate a valid subarray of ar2 . === Weak hash tables === === A weak hash table is a hashed set of values. Each value may magically disappear from the set when it is not used by the rest of the program any more. This is normally used to share data structures without inducing memory leaks. Weak hash tables are defined on values from a Hashtbl.HashedType module; the equal relation and hash function are taken from that module. We will say that v is an instance of x if equal x v is true. The equal relation must be able to work on a shallow copy of the values and give the same result as with the values themselves. === module type S = sig end The output signature of the functor Weak.Make . module Make : functor (H : Hashtbl.HashedType) -> sig end Functor building an implementation of the weak hash table structure. OCamldoc 2014-06-09 Weak(3)
All times are GMT -4. The time now is 07:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy