sort and diff 2 files

Posted on 2008-02-05
Medium Priority
Last Modified: 2013-12-26
i have to compare 2 flat files in unix containg 27 columns separated by pipe. the filename shall have dates assigned and i need to first sort the files in say ascending order and then compare it with yesterdays file and write output to a 3 file . this is to be done to find out what has changed between todays and yesterdays file.what is the best way to do this?the first column is date .
sample file with 2 rows.
2008-01-01|10|7126|3887|5297|*|187|2401|4421|11|15|1|6|45|5237880.77|xxxxx|hgfdfgbfg|9999-12-1|2008-02-02|fgf275|||2008-02-02|2008-02-02 07:50:57|||
2008-01-01|10|7126|3887|5297|*|187|2394|4411|11|15|1|6|46|250000.00|xxxxx|dfgfdgfd|9999-12-31|2008-02-02|hjh275|||2008-02-02|2008-02-02 07:50:57|||
Question by:rajeshnayakwadi
  • 2
LVL 85

Accepted Solution

ozo earned 2000 total points
ID: 20824552
do you mean ascending by date?
sort file1 > file1.sort
sort file2 > file2.sort
comm -3 file1.sort file2.sort

Author Comment

ID: 20824720
i think if file needs to be sorted by all 27 columns .
LVL 85

Expert Comment

ID: 20824805
So do the above commands do what you want?

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question