10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi Friends,
My input file is like this
chr1 100 200
chr1 300 330
chr1 2000 2000
chr1 5000 5000
chr2 7790 7890
chr2 8000 8000
If the difference of third and second columns is zero, then subtract 500 from second column and add 500 to the third column.
So, my output would be
chr1... (1 Reply)
Discussion started by: jacobs.smith
1 Replies
2. 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
3. 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
4. Shell Programming and Scripting
Hello,
Consider the following 2 arrays:
Array1 = qw(Fa0/0 Fa0/1 Fa0/2 Fa0/3);
Array1 = qw(Fa0/1 Fa0/2 Fa0/3 Fa0/4);
I want to compare the following 2 arrays as follows:
Take specific action when elements of Array1 that doesn't exist in Array2 (in my example: Fa0/0).
Take another... (4 Replies)
Discussion started by: ahmed_zaher
4 Replies
5. Shell Programming and Scripting
Hi,
I have 2 arrays:
@a=qw(19190289 18381856 12780546 10626296 9337410 8850557 7740161 8101063);
@b=qw(18309897 17612870 10626296 16871843 7740161 19947571 18062861);
$len=@a;
print "<br> length of array1: $len<br>";
$len1=@b;
print "<br> length of array2: $len1<br>";
The output... (3 Replies)
Discussion started by: vanitham
3 Replies
6. 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
7. 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
8. Shell Programming and Scripting
Hi,
I am not that good at Perl.
But here's what I wanna do.
I want to create a hash where the keys would point to different arrays. This is what I have tried to do but in vain :(
@arr=(1,2,3);
@arr1=(3,2,1);
%hashOfLists=();
$hashOfLists{Key1}=@arr."\n";
$hashOfLists{Key2}=@arr1."\n";... (3 Replies)
Discussion started by: King Nothing
3 Replies
9. 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
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