10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Hello, i am trying to print group name column(etc/group) on script (etc/passwd) since group name is not listed on etc/passwd columns. Im trying to do a vlookup. but i cant figure out how i can insert the vlookup command FNR==NR inside the print out command or the output. I also tried exporting... (2 Replies)
Discussion started by: joonisio
2 Replies
2. Shell Programming and Scripting
I need to vlookup and check the server not found.
Source file 1
server1
server2
server3
server4
server5_root
server6_silver
server7
server7-test
server7-temp
Source file 2
server1_bronze (6 Replies)
Discussion started by: ranjancom2000
6 Replies
3. Shell Programming and Scripting
I have 2 files namely branch.txt file & RXD.txt file as below
Ex:Branch.txt
=========================
B1,Branchname1,city,country
B2,Branchname2,city,country
B3,Branchname3,city,country
B4,Branchname4,city,country
B5,Branchname5,city,country
RXD file : will... (11 Replies)
Discussion started by: satece
11 Replies
4. Shell Programming and Scripting
Hi,
I am new to awk/unix and am trying to put together an awk script to perform an action similar to vlookup between the two csv files.
Here are the contents of the two files:
File 1:
Date,ParentID,Number,Area,Volume,Dimensions
2014-01-01,ABC,247,83430.33,857.84,8110.76... (9 Replies)
Discussion started by: Prit Siv
9 Replies
5. Shell Programming and Scripting
hi frnds
i have 2 files. 1st is dddd and 2nd is ssss
==> dddd <==:
1,charit
2,gilhotra
==> ssss <==:
1,sajan
2,doda
3,hello
and i want o/p ...mean join and vlookup both files
sajan,charit (4 Replies)
Discussion started by: dodasajan
4 Replies
6. Shell Programming and Scripting
I would like to merge data from a reference file and a data file to produce a new output file as shown below.
Reference file,data file,output file
a , b 2 , a 0
b , d 4 , b 2
c , , c 0
d , , d 4
e, , e 0 (3 Replies)
Discussion started by: godzilla07
3 Replies
7. Shell Programming and Scripting
I got many pair files, which only have small difference, such as more space, or more empty line, and some unreadable characters.
If list by commend "diff", I can see many many difference.
So I'd like to write a script to compare the pair files, if 95% contents are same, I will think they are... (2 Replies)
Discussion started by: rdcwayx
2 Replies
8. Shell Programming and Scripting
Dear All,
i want to implement vookup function which is there in excel into Unix. Suppose i have 2 files. The files are given below.
File1:
MSC Cell SDCA
Patna-1 12 Bihar
Patna-2 45 Ranchi
Bhopal-1 85 Raigarh
Bhopal-2 ... (8 Replies)
Discussion started by: pravani1
8 Replies
9. Shell Programming and Scripting
Kindly help me to build the script similar to VLOOKUP function of MS Excell. (5 Replies)
Discussion started by: hjoshi
5 Replies
10. UNIX for Dummies Questions & Answers
I would like to know how to compare a listing of directories that begin with the same four numbers ie.
/1234cat
/1234tree
/1234fish
and move all these directories into one directory
Thanks in advance (2 Replies)
Discussion started by: tgibson2
2 Replies
Data::Compare(3) User Contributed Perl Documentation Data::Compare(3)
NAME
Data::Compare - compare perl data structures
SYNOPSIS
use Data::Compare;
my $h1 = { 'foo' => [ 'bar', 'baz' ], 'FOO' => [ 'one', 'two' ] };
my $h2 = { 'foo' => [ 'bar', 'barf' ], 'FOO' => [ 'one', 'two' ] };
my @a1 = ('one', 'two');
my @a2 = ('bar', 'baz');
my %v = ( 'FOO', @a1, 'foo', @a2 );
# simple procedural interface
print 'structures of $h1 and \%v are ',
Compare($h1, \%v) ? "" : "not ", "identical.
";
print 'structures of $h1 and $h2 are ',
Compare($h1, $h2, { ignore_hash_keys => [qw(foo)] }) ? '' : 'not ',
"close enough to identical.
";
# OO usage
my $c = new Data::Compare($h1, \%v);
print 'structures of $h1 and \%v are ',
$c->Cmp ? "" : "not ", "identical.
";
# or
my $c = new Data::Compare;
print 'structures of $h and \%v are ',
$c->Cmp($h1, \%v) ? "" : "not ", "identical.
";
DESCRIPTION
Compare two perl data structures recursively. Returns 0 if the structures differ, else returns 1.
A few data types are treated as special cases:
Scalar::Properties objects
This has been moved into a plugin, although functionality remains the same as with the previous version. Full documentation is in
Data::Compare::Plugins::Scalar::Properties.
Compiled regular expressions, eg qr/foo/
These are stringified before comparison, so the following will match:
$r = qr/abc/i;
$s = qr/abc/i;
Compare($r, $s);
and the following won't, despite them matching *exactly* the same text:
$r = qr/abc/i;
$s = qr/[aA][bB][cC]/;
Compare($r, $s);
Sorry, that's the best we can do.
CODE and GLOB references
These are assumed not to match unless the references are identical - ie, both are references to the same thing.
You may also customise how we compare structures by supplying options in a hashref as a third parameter to the "Compare()" function. This
is not yet available through the OO-ish interface. These options will be in force for the *whole* of your comparison, so will apply to
structures that are lurking deep down in your data as well as at the top level, so beware!
ignore_hash_keys
an arrayref of strings. When comparing two hashes, any keys mentioned in this list will be ignored.
CIRCULAR STRUCTURES
Comparing a circular structure to itself returns true:
$x = $y;
$y = $x;
Compare([$x, $y], [$x, $y]);
And on a sort-of-related note, if you try to compare insanely deeply nested structures, the module will spit a warning. For this to affect
you, you need to go around a hundred levels deep though, and if you do that you have bigger problems which I can't help you with ;-)
PLUGINS
The module takes plug-ins so you can provide specialised routines for comparing your own objects and data-types. For details see
Data::Compare::Plugins.
Plugins are *not* available when running in "taint" mode. You may also make it not load plugins by providing an empty list as the argument
to import() - ie, by doing this:
use Data::Compare ();
A couple of functions are provided to examine what goodies have been made available through plugins:
plugins
Returns a structure (a hash ref) describing all the comparisons made available through plugins. This function is *not* exported, so
should be called as Data::Compare::plugins(). It takes no parameters.
plugins_printable
Returns formatted text
EXPORTS
For historical reasons, the Compare() function is exported. If you don't want this, then pass an empty list to import() as explained under
PLUGINS. If you want no export but do want plugins, then pass the empty list, and then call the register_plugins class method:
use Data::Compare ();
Data::Compare->register_plugins;
or you could call it as a function if that floats your boat.
SOURCE CODE REPOSITORY
<git://github.com/DrHyde/perl-modules-Data-Compare.git>
BUGS
Plugin support is not quite finished (see the TODO file for details) but is usable. The missing bits are bells and whistles rather than
core functionality.
Please report any other bugs either by email to David Cantrell (see below for address) or using rt.cpan.org:
<https://rt.cpan.org/Ticket/Create.html?Queue=Data-Compare>
AUTHOR
Fabien Tassin <fta@sofaraway.org>
Portions by David Cantrell <david@cantrell.org.uk>
COPYRIGHT and LICENCE
Copyright (c) 1999-2001 Fabien Tassin. All rights reserved. This program is free software; you can redistribute it and/or modify it under
the same terms as Perl itself.
Some parts copyright 2003 - 2013 David Cantrell.
Seeing that Fabien seems to have disappeared, David Cantrell has become a co-maintainer so he can apply needed patches. The licence, of
course, remains the same. As the "perl licence" is "Artistic or GPL, your choice", you can find them as the files ARTISTIC.txt and
GPL2.txt in the distribution.
SEE ALSO
perl(1), perlref(1)
perl v5.18.2 2013-09-26 Data::Compare(3)