Perl - Compare two files and copy intire line to final.log

Posted by user2977141 on Stack Overflow See other posts from Stack Overflow or by user2977141
Published on 2013-11-10T21:37:03Z Indexed on 2013/11/10 21:54 UTC
Read the original article Hit count: 159

Filed under:
|

I need perl script to compare line from file1 with file2 and copy to final file, something like this:

File1.txt:

  • ASPO01
  • ASPO02
  • ASPO03

File2.txt:

  • ASPO01 2013-11-10 19hrs
  • ASPO10 2013-11-09 24hrs
  • ASPO02 2013-11-08 10hrs
  • ASPO16 2013-11-05 9hrs
  • ASPO17 2013-11-06 6hrs
  • ASPO03 2013-11-07 15hrs
  • ASPO18 2013-11-02 25hrs
  • ...

Search into File2 and copy to final file called final.log, like this:

final.txt:

  • ASPO01 2013-11-10 19hrs
  • ASPO02 2013-11-08 10hrs
  • ASPO03 2013-11-07 15hrs

Thanks for all good friends can help me!!!

© Stack Overflow or respective owner

Related posts about perl

Related posts about unix-timestamp