Sponsored Content
Top Forums Shell Programming and Scripting Cleaning up Arrays with duplicate values Post 302439803 by radoulov on Friday 23rd of July 2010 06:26:05 PM
Old 07-23-2010
Something like this:

Code:
@merge{@linecount, @hit} = (1) x @linecount + @hit;
@all_unique = sort { $a <=> $b } keys %merge;

 

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
Tangram::Type(3pm)					User Contributed Perl Documentation					Tangram::Type(3pm)

NAME
Tangram::Type - mapping individual fields DESCRIPTION
Tangram's persistent type system is extensible, allowing you to mount your own types and make them persistent. All you have to do is to register your type and provide mapping code. See Tangram::Type::Extending. Tangram comes with built-in support for the following types: Simple Scalar types Supported are strings, integers, real numbers and dates. More types of this ilk are easily added. "string", "int", "real": see Tangram::Type::Scalar "date", "time", "datetime", "dmdatetime": see "Date/Type/Date/DateTime" in Tangram::Type Compound Structure types "perl_dump": see Tangram::Type::Dump::Perl. A "perl_dump" structure may contain any structure which Data::Dumper can dump success- fully. "storable": see Tangram::Type::Dump::Storable. Very much like "perl_dump", but implemented via the `Storable' serialisation engine. "yaml": see Tangram::Type::Dump::YAML. Very much like "perl_dump", but implemented via the `YAML' serialisation engine. Doesn't cur- rently work, due to inadequacies in the current Perl YAML implementation. NEW in Tangram 2.08: "idbif": see Tangram::Type::Dump::Any. Like the above, but can combine multiple object properties into a single database column. `Flat' Array & Hash types Note: these are only actually required if you need to be able to query on individual fields inside the array/hash - otherwise, the "perl_dump" or "idbif" mapping is a lot faster and more flexible. "flat_array": see "Array/Scalar" in Tangram::Type "flat_hash": see "Hash/Scalar" in Tangram::Type References to other objects "ref": see Tangram::Type::Ref::FromMany (implementing an N to 1 relationship, in which any object can be the referant) Sets of other objects Set relationships are closest to the main type of relationship used in an RDBMS. Avid CompSci students will know that the relational database model is based heavily on `Set Theory', which is a subset of a more general concept of `Categories' - generic couplings of a number of classes. In Perl space, these collections are represented via the Set::Object module. Sets may not have duplicate elements, and cannot contain undef values. "set": see Tangram::Type::Set::FromMany (implementing an unordered N to N relationship, with all objects sharing a common base class) "iset": see Tangram::Type::Set::FromOne (implementing an unordered 1 to N relationship, with all objects sharing a common base class) Arrays of other objects The addition to Sets, you can have `Arrays' of objects, represented by a standard Perl array in memory. Arrays may contain undef val- ues (in the middle of the list), and the "array" type may contain duplicates (ie, the same element present in seperate places in the list). "array" : see Tangram::Type::Array::FromMany (implementing an ordered N to N relationship, with all objects sharing a common base class) "iarray": see Tangram::Type::Array::FromOne (implementing an ordered 1 to N relationship, with all objects sharing a common base class) Hashes of other objects Much like the Array types, the Hash types are indexed via a string value, and represented as a Perl hash in memory. These hashes may not contain undef values (those are dropped). The "hash" type may contain duplicate elements. "hash" : see Tangram::Type::Hash::FromMany (implementing a keyed N to N relationship, with all objects sharing a common base class) "ihash": see Tangram::Type::Hash::FromOne (implementing a keyed 1 to N relationship, with all objects sharing a common base class) perl v5.8.8 2006-03-29 Tangram::Type(3pm)
All times are GMT -4. The time now is 11:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy