Created
June 28, 2013 10:38
-
-
Save davorg/5883837 to your computer and use it in GitHub Desktop.
Add an MD5 hash to lines of data that have already been seen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use 5.010; | |
use Digest::MD5 'md5_hex'; | |
my %seen; | |
while (<DATA>) { | |
chomp; | |
$_ .= ' ' . md5_hex($_) if $seen{$_}++; | |
say $_; | |
} | |
__DATA__ | |
NAME AGE GENDER DEP-Id Company | |
AA 30 M IT-001 google.com | |
AA 30 M IT-001 google.com | |
AB 40 F IT-002 Yahoo.com | |
AB 40 F IT-002 Yahoo.com | |
AC 50 F IT-004 ABC.com | |
AC 50 F IT-004 ABC.com | |
AA 30 M IT-001 google.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment