Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a text file which was with nice linebreaks. By mistake my customer opened it in wordpad an saved it. All line breaks are now gone.

Is there a way to restore the line breaks again?

share|improve this question
2  
Pull the previous version from shadow copies, source control, backups, whatever? Also apparently it's your file and the customer messed it up? Why not use your own copy? –  Joey Jun 17 '10 at 11:49
    
The original was a language file. He translated it during the weekend - in wordpad. So there is no backup. –  Cudos Jun 17 '10 at 12:05
    
doesn't sound like wordpad's fault but like your customer's. Especially the "no backup" :( –  Tobias Kienzler Jun 17 '10 at 12:08
    
Yes, I know.. Just making a last effort because the customer is almost heart broken. –  Cudos Jun 17 '10 at 12:11
    
As Johannes said, Shadow Copy should be good, at least if it's Windows. –  Christoffer Madsen Jun 17 '10 at 12:16

4 Answers 4

up vote 3 down vote accepted

If the customer just opened it in Wordpad and saved it, that would just mean the linebreaks are Windows (CR+LF) as I understand it. In that situation you can use any decent text editor that understands/converts between different linebreaks.

But then I guess you wouldn't be posting if it was that simple. Can you give more details on what the customer did? Are you sure the customer didn't delete the linebreaks?

The best way to understand what you have in your translated file is to use a hex editor to inspect it, and see what lies around the areas where there should be linebreaks. If there's nothing in the file to separate different lines then I think you're pretty much stuffed.

share|improve this answer
    
Yes, I just tried a hex editor. No line breaks there :( I will have to tell the customer the bad news. –  Cudos Jun 17 '10 at 12:37
    
Sorry to hear that. –  Andy Jun 17 '10 at 12:56

Open it in wordpad, ctrl+c, ctr+v in notepad and it is all folks :)

share|improve this answer
    
This is what I would have done. –  Hondalex Jun 17 '10 at 20:46

Is my answer to simple just put them back in, express to the customer where they were before the translation and let them manually put them back in.

share|improve this answer
    
With 2900+ lines that's not going to happen –  Cudos Jun 17 '10 at 13:31
    
Ouch. Can you post eg. ten lines of the original and translated files? Just to see if inspiration flows on trying to (partially) automate the task. –  Andy Jun 17 '10 at 14:46

Is there some kind of grammatical pattern to the file that can be used to insert the linebreaks?

Of course, it'd be real convenient if there were periods preceding where all the former linebreaks were, but that's probably not the case. However, there might still be other patterns. For instance, if these are flash messages for a CRUD application, you might have patterns like:

*deleted.
*updated.
*added.
*try again.
*?
Error:*

If you can come up with a creative way to figure out where the linebreaks need to go, then you could probably write a script to put them back in.

What I can't understand is, while the customer was editing the file, surely he noticed that there weren't linebreaks. What did he expect would be used to delimit the separate messages? Did he put commas in their place? If he just translated the entire 2900+ line file without putting any separator between the separate lines, then, sad to say, this is his punishment for lacking commonsense.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.