Compare 2 files the send output to a file

Hallo Friends,

I would like to compare two files, then write the difference between the two into output file then find a pattern then search for that pattern.

-bash-3.2$ cat BS_Orig_20141112.csv|head -20
BW0159574451211141638275086@196.35.130.5
BW02043750712111491637691@196.35.130.5
BW020421383121114-180930532@196.35.130.5
BW0201184681211141746103607@196.35.130.5
BW020345972121114-1681948760@196.35.130.5
BW020331222121114-294445536@196.35.130.5
BW020336971121114-355187974@196.35.130.5
BW020437153121114387863052@196.35.130.5
BW020353585121114103735320@196.35.130.5
BW020317092121114279456245@196.35.130.5
BW084013396121114511570322@196.35.130.5
BW103120541121114-1688959305@196.35.130.5
BW080047046121114711500840@196.35.130.5
BW080143363121114-1150959720@196.35.130.5
BW130524870121114-1387080302@196.35.130.5
-bash-3.2$ cat BS_Orig_20141112.csv|wc -l
1921373
-bash-3.2$
-bash-3.2$ cat missing_revenue_20141112.csv|head -20
BW0522168531211141180935668@196.23.110.141
BW092218784121114-370120610@196.23.110.141
BW1404407551211141874517771@196.23.110.141
BW001058223121114-2086341879@196.35.130.5
BW001126190121114-710205576@196.35.130.5
BW002549135121114563646299@196.35.130.5
BW0053227321211141454430109@196.35.130.5
BW020430589121114-1737491030@196.35.130.5
BW0206420091211141773544379@196.35.130.5
BW0439517101211141952205283@196.35.130.5
BW051813264121114-676811767@196.35.130.5
BW060319275121114790906797@196.35.130.5
BW061524500121114845368553@196.35.130.5
BW0617193031211141958558621@196.35.130.5
BW084013396121114511570322@196.35.130.5
BW103120541121114-1688959305@196.35.130.5
BW080047046121114711500840@196.35.130.5
BW080143363121114-1150959720@196.35.130.5
BW130524870121114-1387080302@196.35.130.5
bash-3.2$ cat missing_revenue_20141112.csv|wc -l
1226248
-bash-3.2$

i would like to compare the two files then place the difference into file_a.csv

Regards,

Pax

Pax,

What have you tried?
Have you looked into man sort (linux), man diff (linux), and/or man comm (linux)?

  • Derek

There is also grep to consider. What output are you expecting from the sample input.

I'm a little confused to the eventual output. Can you explain a little more about the eventual target. There may be other more efficient ways to deliver your requirement.

Is this actually the same as this post?

Robin