11-26-2008
Compare Array
Hi joeyg,
The values are not stored in a file, they are stored inside an Array.
I need to compare the arraies values , and create new array based on the unmached values.
Thank Again
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
Can anybody tell me how can I dump the results of execution of a command into array form? For example, I want to execute:
and put each part of the result in an array element:
Thanks (2 Replies)
Discussion started by: alirezan
2 Replies
2. Shell Programming and Scripting
Hi All
I am going crazy trying to resolve this easy task....
I have a log file that is created by xcode; and it contains the results of a build (either success or fail); what i am trying to achieve here is to get the result from the log, and check if is a pass or fail in an IF statement, so... (3 Replies)
Discussion started by: newbiez
3 Replies
3. Shell Programming and Scripting
Hi ,
I am not familiar with shell programming. I have a requirement like i have two files
.I need to compare the two files by comparing each parameter and i should produce 2 outputs.
1)i have around 35 parameters say i have one parameter name called db_name=dcap in one file and... (7 Replies)
Discussion started by: muraliinfy04
7 Replies
4. Shell Programming and Scripting
I'm trying to add the paths of all the xml files in certain directories to an array. I want to use the array later in my code. Anyway, for some reason this isn't working. Any help would be appreciated.
Path_Counter=0
for result in "find * -name '*.xml'"; do
XmlPath="$result"
echo... (2 Replies)
Discussion started by: Fly_Moe
2 Replies
5. Shell Programming and Scripting
Hi, I just wondering if I want to compare previous value to next value if it same count + 1 if not doesn't count how do we compare in Perl? Thank (2 Replies)
Discussion started by: guidely
2 Replies
6. Shell Programming and Scripting
Hi firnds,
I am having two arrays
eg. @a=qw(1 2 3 4) and @b=qw(1 3 6 9)
Now, I want to compare two arrays on first index of both arrays and if they matched, it should output remaining indexes
Pseudo-code
if ($a == $b)
{ print "remaining indexes";}
How can i do this using perl? (1 Reply)
Discussion started by: Renesh
1 Replies
7. Shell Programming and Scripting
ok, so here is the issue, I have 2 arrays.
I need to be able to create a loop that will find ${ARRAY1 in the text doc, and replace it with ${ARRAY2 then write the results. I already have that working. The problem is, I need it to do that same result across however many items are in the 2... (2 Replies)
Discussion started by: gentlefury
2 Replies
8. Shell Programming and Scripting
Requirement 1) I need to execute 15 SQL queries in oracle through linux script. All these query results needs to be stored in array variables.
Requirement 2) And these 15 queries needs to be executed in parallel.
Requirement 3) Once all the queries executed then the shell script should... (3 Replies)
Discussion started by: Niranjancse
3 Replies
9. Shell Programming and Scripting
for a in {1..100}
do
awk '{ sum+=$a} END {print sum}' a=$a file1 > file2
done
I know I will get only one number if following the code above, how can I get 100 sum numbers in file2? (2 Replies)
Discussion started by: wanliushao
2 Replies
10. Programming
Can C add its results into an array like bash? For example using bash:
cat /etc/passwd
**truncated for space **
gdm:x:109:118:Gnome Display Manager:/var/lib/gdm:/bin/false
mysql:x:110:122:MySQL Server,,,:/nonexistent:/bin/false
statd:x:111:65534::/var/lib/nfs:/bin/false... (5 Replies)
Discussion started by: metallica1973
5 Replies
LEARN ABOUT PHP
array_intersect_assoc
ARRAY_INTERSECT_ASSOC(3) 1 ARRAY_INTERSECT_ASSOC(3)
array_intersect_assoc - Computes the intersection of arrays with additional index check
SYNOPSIS
array array_intersect_assoc (array $array1, array $array2, [array $...])
DESCRIPTION
array_intersect_assoc(3) returns an array containing all the values of $array1 that are present in all the arguments. Note that the keys
are used in the comparison unlike in array_intersect(3).
PARAMETERS
o $array1
- The array with master values to check.
o $array2
- An array to compare values against.
o $...
- A variable list of arrays to compare.
RETURN VALUES
Returns an associative array containing all the values in $array1 that are present in all of the arguments.
EXAMPLES
Example #1
array_intersect_assoc(3) example
<?php
$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
$array2 = array("a" => "green", "b" => "yellow", "blue", "red");
$result_array = array_intersect_assoc($array1, $array2);
print_r($result_array);
?>
The above example will output:
Array
(
[a] => green
)
In our example you see that only the pair "a" => "green" is present in both arrays and thus is returned. The value "red" is not returned
because in $array1 its key is 0 while the key of "red" in $array2 is 1, and the key "b" is not returned because its values are different in
each array.
The two values from the key => value pairs are considered equal only if (string) $elem1 === (string) $elem2 . In other words a strict type
check is executed so the string representation must be the same.
SEE ALSO
array_intersect(3), array_uintersect_assoc(3), array_intersect_uassoc(3), array_uintersect_uassoc(3), array_diff(3), array_diff_assoc(3).
PHP Documentation Group ARRAY_INTERSECT_ASSOC(3)