For Programmers: Free Programming Magazines  


Home > Archive > AWK > November 2004 > How to compare two files









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to compare two files
PU239

2004-11-18, 8:56 pm

I am inexpert with awk.
I tried with a K-shell to compare a file against a sample file, record by
record and just a 16 char portion of each one, if both portions are equal
then I write out the full record to another file. It was very slow.
So my question, it's possible to do that in awk, but quite faster?.
I would appreciate any proposition. Thanks.

1) input file A (size file A > 100000 records)
record A format (; field delimiter) PLAS;SUB015678889F32442410R
;?;CCQ4567;? ;6788797

^ ^

|_______________|

key A

2)sample file B (size file B > 100000 records)
record B format (no field delimiter) CCU1001345789F46784544469
^
^

|_______________|

key B

3) IF key A .EQ. key B
THEN
PRINT RECORD A > OUT_FILE





Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com