Compare 3 files, delete data equals.

Hi, i have a problem,

I have three files, file_1, File_2 file_3 and I need to compare the data with file_3 file_1, data that are equal to file_3 file_1 should be deleted, file_1 receive data and file_2 file_3.

Ex:
file_1

374905,2001, Selmar Santos, T�cnico de Sistemas, U$3.000,00
789502, 2008, Eduardo Calmon, Analista S�nior, U$8.000,00
953585, 2010, Carolina Sant Ana, Analista Plena, U$10.000,00

File_2

8795254,2001, Frederico Marlon, T�cnico de Sistemas, U$3.500,00
7989653, 2007, Jamile Cupertino, Analista Junior, U$6.000,00
5823647, 2008, C�lia Cupertino, Gerente, U$11.000,00

File_3

374905,2001, Selmar Santos, T�cnico de Sistemas, U$1.000,00
4528791, 2008, Ana Paula Pertel, Supervisor, U$2.000,00

Result:

File_1

452879, 2008, Ana Paula Pertel, Supervisor, U$2.000,00
953585, 2010, Carolina Sant Ana, Analista Plena, U$10.000,00
582364, 2008, C�lia Cupertino, Gerente, U$11.000,00
789502, 2008, Eduardo Calmon, Analista S�nior, U$8.000,00
879525,2001, Frederico Marlon, T�cnico de Sistemas, U$3.500,00
798965, 2007, Jamile Cupertino, Analista Junior, U$6.000,00
374905,2001, Selmar Santos, T�cnico de Sistemas, U$3.000,00

Please, help me in this question.

Thanks!

Hi Selmar,

If I have understood u clear, this is what you require.
Data common to file_1 and file_3 should be deleted from file_1. Then file_2 and file_3 should be added to file_1.

comm -23 file_1 file_3 > temp.dat
mv temp.dat file_1
cat file_2 >> file_1
cat file_3 >> file_1

the data are deleted from file_3, but the code helped me a lot, thanks.

 awk -F , 'NR==FNR{a[$1]=$0;next} !($1 in a) {print}
          END {for (i in a) print a}' file_1 file_2 file_3