Sponsored Content
Full Discussion: perl: compare two arrays
Top Forums Shell Programming and Scripting perl: compare two arrays Post 302614243 by Renesh on Wednesday 28th of March 2012 11:05:37 AM
Old 03-28-2012
perl: compare two arrays

Hi friends,

I want to compare two arrays and find matched one using perl?
Also, I want to delete unmatched one.

Plz suggest me solution

Last edited by Renesh; 03-28-2012 at 12:14 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Compare two arrays in sh or compare two fields

I want a soultion to compare two arrays in sh with an easy way.I want a solution to synchrose users between different AIX servers where no NIS is available. All users are meant to be same on all 10 servers. So the approach is to consider first server as master user repository and whatever the users... (0 Replies)
Discussion started by: rijeshpp
0 Replies

2. Shell Programming and Scripting

Perl - Compare 2 Arrays

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

3. Shell Programming and Scripting

compare/match arrays

Hi there all, I am having a question. Is it posible to compare elements of 2 different arrays? For example I got Array 1 | Array 2 123_abc | 123_bcd 123_bcd | 234_bcd 234_abc | 567_abc 234_bcd | 123_abc than the match is 123_abc & 234_bcd and non of the others. So... (3 Replies)
Discussion started by: draco
3 Replies

4. Shell Programming and Scripting

Compare arrays in perl

Hello, Let's say that we have the two following arrays @array1= @array2= Is there any easy way to compare these two arrays and print the values that exist in array1 and not in array2 and the values that exist in array2 and not in array1? Regards, Chriss_58 (3 Replies)
Discussion started by: chriss_58
3 Replies

5. Shell Programming and Scripting

compare 2 arrays in perl

Hi Im supposed to compare lines in a file : KB0005 1019 T IFVATVPVI 0.691 PKC YES KB0005 1036 T YFLQTSQQL 0.785 PKC YES KB0005 1037 S FLQTSQQLK 0.585 DNAPK YES KB0005 1045 S KQLESEGRS 0.669 PKC YES KB0005 1045 S KQLESEGRS 0.880 unsp YES KB204320 1019 T IFVATVPVI 0.699 PKC YES ... (7 Replies)
Discussion started by: karla
7 Replies

6. Shell Programming and Scripting

Compare arrays (perl)

Hi, my first post here! Description of my problem: I have one txt-file with six rows and each row contains seven numbers seperated with whitespaces. I want to: Compare one array with seven numbers with each row of numbers in the txt-file. I have managed to compare one array with... (6 Replies)
Discussion started by: mjoh
6 Replies

7. Shell Programming and Scripting

Perl Compare 2 Arrays

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

8. Shell Programming and Scripting

Compare two arrays

Hi, I am trying to compare two lists that are held in two variables so I believe I need to access the array elements to compare these. I am using ksh 88 and the code I have tried is below: for file in ${origfilelist} do if ]] then print -- "File ${file}... (3 Replies)
Discussion started by: frodo61
3 Replies

9. Shell Programming and Scripting

Using Diff to compare 2 arrays

I have two arrays and they look like this: array=(`cat /local/mnt/*sys/*includes|grep -v NEW`) array2=(`cat /tmp/*sys.z |grep -v NEW`) I am trying to compare them but I need to use the diff -u command. I am not sure how to do this. I cannot just do diff -u ${array} ${array2} I cannot... (4 Replies)
Discussion started by: newbie2010
4 Replies

10. UNIX for Beginners Questions & Answers

Compare bash arrays issue

Hello everyone, I need help comparing 2 arrays. the first array is static; the second array is not .. array1=( "macOS Mojave" "iTunes" ) cd /Volumes array2=( * ) # output of array2 macOS Mojave iTunes Mac me The problem occurs when I compare the arrays with the following code - ... (6 Replies)
Discussion started by: trexthurman
6 Replies
std::sub_match< _BiIter >(3)				     Library Functions Manual				      std::sub_match< _BiIter >(3)

NAME
std::sub_match< _BiIter > - SYNOPSIS
Inherits std::pair< _BiIter, _BiIter >. Public Types typedef __iter_traits::difference_type difference_type" typedef _BiIter first_type typedef _BiIter iterator typedef _BiIter second_type typedef std::basic_string < value_type > string_type" typedef __iter_traits::value_type value_type Public Member Functions int compare (const sub_match &__s) const int compare (const string_type &__s) const int compare (const value_type *__s) const difference_type length () const void && noexcept (swap(second, __p.second))) operator string_type () const string_type str () const Public Attributes _BiIter first bool matched _BiIter second Detailed Description template<typename _BiIter>class std::sub_match< _BiIter > A sequence of characters matched by a particular marked sub-expression. An object of this class is essentially a pair of iterators marking a matched subexpression within a regular expression pattern match. Such objects can be converted to and compared with std::basic_string objects of a similar base character type as the pattern matched by the regular expression. The iterators that make up the pair are the usual half-open interval referencing the actual original pattern matched. Definition at line 741 of file regex.h. Member Typedef Documentation typedef _BiIter std::pair< _BiIter , _BiIter >::second_type [inherited] first_type is the first bound type Definition at line 99 of file stl_pair.h. Member Function Documentation template<typename _BiIter> int std::sub_match< _BiIter >::compare (const sub_match< _BiIter > &__s) const [inline] Compares this and another matched sequence. Parameters: __s Another matched sequence to compare to this one. Return values: <0 this matched sequence will collate before __s. =0 this matched sequence is equivalent to __s. <0 this matched sequence will collate after __s. Definition at line 802 of file regex.h. Referenced by std::operator!=(), std::operator<(), std::operator<=(), std::operator==(), std::operator>(), and std::operator>=(). template<typename _BiIter> int std::sub_match< _BiIter >::compare (const string_type &__s) const [inline] Compares this sub_match to a string. Parameters: __s A string to compare to this sub_match. Return values: <0 this matched sequence will collate before __s. =0 this matched sequence is equivalent to __s. <0 this matched sequence will collate after __s. Definition at line 815 of file regex.h. template<typename _BiIter> int std::sub_match< _BiIter >::compare (const value_type *__s) const [inline] Compares this sub_match to a C-style string. Parameters: __s A C-style string to compare to this sub_match. Return values: <0 this matched sequence will collate before __s. =0 this matched sequence is equivalent to __s. <0 this matched sequence will collate after __s. Definition at line 828 of file regex.h. template<typename _BiIter> difference_type std::sub_match< _BiIter >::length () const [inline] Gets the length of the matching sequence. Definition at line 759 of file regex.h. template<typename _BiIter> std::sub_match< _BiIter >::operator string_type () const [inline] Gets the matching sequence as a string. Returns: the matching sequence as a string. This is the implicit conversion operator. It is identical to the str() member function except that it will want to pop up in unexpected places and cause a great deal of confusion and cursing from the unwary. Definition at line 772 of file regex.h. template<typename _BiIter> string_type std::sub_match< _BiIter >::str () const [inline] Gets the matching sequence as a string. Returns: the matching sequence as a string. Definition at line 785 of file regex.h. Referenced by std::sub_match< _Bi_iter >::compare(), and std::operator<<(). Member Data Documentation _BiIter std::pair< _BiIter , _BiIter >::first [inherited] second_type is the second bound type Definition at line 101 of file stl_pair.h. Referenced by std::sub_match< _Bi_iter >::length(), std::sub_match< _Bi_iter >::operator string_type(), and std::sub_match< _Bi_iter >::str(). _BiIter std::pair< _BiIter , _BiIter >::second [inherited] first is a copy of the first object Definition at line 102 of file stl_pair.h. Referenced by std::sub_match< _Bi_iter >::length(), std::sub_match< _Bi_iter >::operator string_type(), and std::sub_match< _Bi_iter >::str(). Author Generated automatically by Doxygen for libstdc++ from the source code. libstdc++ Tue Jun 10 2014 std::sub_match< _BiIter >(3)
All times are GMT -4. The time now is 12:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy