rot13 is entirely reversible.

fmt isn't explicitly reversible, but it it doesn't necessarily hurt the 'meaning' - a textfile that's been formatted is still going to be readable. However what it's effectively doing is 'removing' your line boundaries, which are field delimiters used in 'sort' and 'uniq'

sort is removing information - the word order.

uniq is also removing information - the number of occurances of each word.

Oh, and the perl regexp is also removing information from your source data, which given it starts as postscript may be a problem.

Outside very trivial cases, a 'sort | uniq' will effectively destroy the meaning of the information contained in a file, and is effectively irreversible.

This doesn't necessarily mean all is lost, however you'll be reduced to jigsaw puzzle 'reconstruction' rather than any form of automatic process.

Start by reversing the rot13. That's trivial - just rot13 it again

Then you' get to try and figure out where the line breaks were. This _should_ be doable, because your text is sorted alphabetically - the 'start' of the next line will be alphabetically 'after' the start of the current line, and only 'just'.

Reversing the sort is going to be a guessing game I'm afraid. As is reversing the uniq. Because they both work on a full line at a time, it may be possible to do this, but I don't think postscript has any form of sequencing

Reversing the 'formatting strip', might again, be doable, but will require you to have a look at the postscript format. I seem to recall that postscript only tends to use '%'s and '/'s, which again, you may be able to reconstruct by guesswork, and by counting whitespace - cleartext is unlikely to have a triple space, so it might well be a good indicator that it was replacing ' / ' for example.

All the above is liable to be fairly time consuming, and there's no guarantee of success. A partial result (e.g. restore original content, rather than formatting) may be achieveable, but that depends an awful lot on what the source data were.

Of course, you could always go for plan B, and go hunting for 'filename.ps' in your collegue's home directory/elsewhere on the network.


In reply to Re: can this text be recovered??? by Preceptor
in thread can this text be recovered??? by brandnewyou

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.