Hi, I hav two files a1.txt and a2.txt,
a1.txt contains: --------------- asdev ebcdev ....
a2.txt contains: --------------- asdev ebcdev prod .... a1.txt will be updated by a process,.. now i want to compare two files and i want to see data which is not in a1.txt
am i clear....??
regards leenus
search the forum
Depending on what type of output you want, you could use com, diff or grep -f.
#!/usr/bin/perl open(FILE, "<", "a1.txt" ) || die "Unable to open file a <$!>\n"; while ( <FILE> ) { chomp; $fileHash{$_} = $i++; } close(FILE); open(FILE, "<", "a2.txt" ) || die "Unable to open file a <$!>\n"; while( <FILE> ) { chomp; if( exists $fileHash{$_} ) { } else { print "$_\n"; } } close(FILE); exit 0
Thanks, Mukund Ranjan