I have two comma delimited files that I need to compare and have the differences written to a third csv file. Basically I have a csv file of 10,000 students that started the semester, after drop date I now have a second csv file with only 9000 students that are still enrolled. I need an output file, in the same format as the first two, that lists the 1000 or so students that dropped so I can remove the accounts. A lot of information has changed for each user, passwords, expiration dates, so the only reliable field for comparison is "id" but I still need the whole line printed out in a new file. An example below.
First file
id,lastname,firstname,defaultserver,password,expiration
1524781,Anderson,Jon,srv01,jon,12-05-02.
1843552,Bruford,William,srv01,william,12-17-02.
7589243,Howe,Steven,srv01,steven,12-05-02.
0547629,Squire,Chris,srv01,chris,12-05-02.
5486135,Wakeman,Rick,srv01,rick,12-17-02.
Second file.
id,lastname,firstname,defaultserver,password,expiration.
1524781,Anderson,Jon,srv01,jon,12-05-02.
1843552,Bruford,William,srv01,william,12-17-02.
0547629,Squire,Chris,srv01,chris,12-05-02.
Output file.
id,lastname,firstname,defaultserver,password,expiration.7589243,Howe,Steven,srv01,steven,12-05-02.
5486135,Wakeman,Rick,srv01,rick,12-17-02.
I have many problems like this, and I have heard PERL is excellent with files, so I am looking into learning it to manage these tasks. Any help would be greatly appreciated.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.