Thanks talexb for the feedback. I was on holidays for the last two weeks so I'm just answering now.

I think I should explain the task of the script again:
I'm using a lot of MD5 checksum files (md5sums), which hold MD5/file name pairs, for comparison and also for my CD/DVD data backups to verify if they got burned correctly. I also update md5sums files from time to time (see my script addmd5). For several different reasons I like to have these files (i.e. the content of the files) sorted alphabetically after the filename, not the MD5 sum. Therefore a simple sort doesn't work.

The sortmd5 script takes a md5sums file, splits MD5 sums and file names and sorts them after the file names, then joins the lines again and outputs the result.

The default is to work in-place (similar to the -i switch), i.e. write the result back to the original file, if no output file name is given. If the input file had unreadable lines a backup is created before it is overwritten.

Usage example:
The following input MD5 file

443..29D test.avi 563..D93 xyz AB2..FFE a.file
is rewritten to:
AB2..FFE a.file 443..29D test.avi 563..D93 xyz

In reply to Re^2: sortmd5 script by mscharrer
in thread sortmd5 script by mscharrer

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.