http://www.perlmonks.org?node_id=1058134


in reply to Merge the difference between two files and save it on the first file. Also update the first file with info in second file.

As a one-liner: (make sure you keep a copy of file1 around...)

perl -ne "/^([^=]+)/ and $_{$1}=$_; END {print sort values %_}" file1 +file2 > file1
  • Comment on Re: Merge the difference between two files and save it on the first file. Also update the first file with info in second file.
  • Download Code