10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
The code I have is kind of long, so I'm just posting the part I'm struggling with. I've found many examples online of comparing two arrays in Bash and printing the difference between them. I've tried them all, even mixed and matched some examples with no luck. I know this can't be as hard as I'm... (9 Replies)
Discussion started by: Azrael
9 Replies
2. Shell Programming and Scripting
Hi all,
I have a log file which has logs. I am reading logs line by line into perl arrays. I want to print all the arrays elements starting from 8(word) to end of the line.
print array......array to a new file. and I have to do it in perl as res of the program in perl.
Please help me on... (9 Replies)
Discussion started by: firestar
9 Replies
3. Shell Programming and Scripting
Hi,
I need an elegant solotion in php. I need to compare 2 arrays (array1 & array2), to find all instances of array 2 which is not in array1.
I don't want to see any instances of array1 wich is not in array2 (here "the")
Array1: This, is, the, data, of, array1
Array2: this, is, data, Of,... (2 Replies)
Discussion started by: lowmaster
2 Replies
4. Shell Programming and Scripting
Hi,
Could someone please help me with this? I have two arrays and I need to generate third array containing difference between the two. For example -
@Array1 = ;
@Array2 = ;
I would like to find difference between these two and generate third array that contains the difference. In... (5 Replies)
Discussion started by: sncoupons
5 Replies
5. Shell Programming and Scripting
Hi,
I have 2 arrays.
I have to compute symmetric difference!
@arr=qw(19205134 18630215 18453487 18416242 18338715 18227590 17698645);
@arr1=qw(18227590 18053561 17698645 16966777);
#The code which i used is this!
@union = @isect = @diff = ();
%union = %isect = ();
%count =... (3 Replies)
Discussion started by: vanitham
3 Replies
6. Shell Programming and Scripting
Hi all,
I am trying to compare two arrays in perl using the following code.
foreach $item (@arrayA){
push(@arrayC, $item) unless grep(/$item/, @arrayB); ... (1 Reply)
Discussion started by: chriss_58
1 Replies
7. Shell Programming and Scripting
Hi
I need some help using arrays in perl.
I have an array say var and a variable var1.
I want to check if the var1 is present in the array. How do I check that ?
my @var = 1...10;
my $var1 =5;
if ( $var1 in @var )
{
.......
}
else
{
.......
}
Something like above. Can some... (2 Replies)
Discussion started by: ammu
2 Replies
8. Shell Programming and Scripting
Hi all,
I have the following script where the contents of file1 and file2 would be something like this:
file1:
56790,0,0,100998765
89756,0,0,100567876
867645,1,3,678777654
file2:
56790,0,0,100998765
65776,0,0,4766457890
+5896,0,0,675489876
What I then want to do is check if... (4 Replies)
Discussion started by: Donkey25
4 Replies
9. Shell Programming and Scripting
@xray =~ s/^ *//g;
@xray =~ s/ *$//g;
@xray =~ s/\s+/ /g;
Guess I have a two part question ...
First
Is there a way to make substitutions, remove leading spaces, trailing spaces, and crunch multiple spaces into a single space, to the entire array, or must the substitutions be done on on... (1 Reply)
Discussion started by: popeye
1 Replies
10. Programming
hello ppl,
i'm coding a perl script and i have the following situation:
@array1 = ("test1", "test2", "test3");
@array2 = ("something1", "something2", "something1");
$var1 = "with_one_of_the_array1_values";
$var2 = "with_one_of_the_array2_values";
what i want to do is to compare $var1... (2 Replies)
Discussion started by: crashnburn
2 Replies