Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Corrupted File Help

  • 26-01-2011 11:55pm
    #1
    Registered Users, Registered Users 2 Posts: 1,129 ✭✭✭


    Hi Guys,

    Bit of help needed. My friend who is doing a 4th year thesis at the minute rang me an hour ago desperately asking for help to try recover a windows works document (.wps), why they were using this and not backing up files is another issue. I've followed all the instructions I can to try recover it but to no avail.

    I have however managed to extract all of the vital text into a .txt file. The problem is that there is a space between every letter in each word and then three spaces between each word where there should be a single space. If I can get this cleaned up it should be a simple copy paste to get it back into standard format. Here's a short example of what i mean where each underscore denotes a space.
    _F_i_g_u_r_e___3_:___C_o_m_p_a_r_i_s_o_n___b_e_t_w_e_e_n___t_h_e___s_t_r_u_c_t_u_r_e___o_f___t_h_e

    Undoubtedly there's an easy way to do this *nix style so if anyone could give any help that'd be great.


    Edit: Literally just after i posted it I thought of a handy way to do this using gedits search replace. I search replace " " and replaced it with ~ and then search replaced " " and replaced it with nothing. I then search replaced ~ and replaced it with a space and hey presto, nice and readable.


Comments

  • Moderators, Arts Moderators Posts: 35,787 Mod ✭✭✭✭pickarooney


    I'm not sure but I think this comes about as a result of switching between UNIX and DOS text formats. There's a command called unix2dos and one called dos2unix which switch text files between the two. But you seem to have used some good logic to fix it :)


  • Registered Users, Registered Users 2 Posts: 1,110 ✭✭✭Skrynesaver


    pljudge321 wrote: »
    Hi Guys,

    Bit of help needed. My friend who is doing a 4th year thesis at the minute rang me an hour ago desperately asking for help to try recover a windows works document (.wps), why they were using this and not backing up files is another issue. I've followed all the instructions I can to try recover it but to no avail.

    I have however managed to extract all of the vital text into a .txt file. The problem is that there is a space between every letter in each word and then three spaces between each word where there should be a single space. If I can get this cleaned up it should be a simple copy paste to get it back into standard format. Here's a short example of what i mean where each underscore denotes a space.



    Undoubtedly there's an easy way to do this *nix style so if anyone could give any help that'd be great.


    Edit: Literally just after i posted it I thought of a handy way to do this using gedits search replace. I search replace " " and replaced it with ~ and then search replaced " " and replaced it with nothing. I then search replaced ~ and replaced it with a space and hey presto, nice and readable.

    Glad you found a method but consider sed or even Perl when you need to make repetitive edits to text.
     sed 's/__/ /g; s/_//g'  corrupt_file.txt
    


Advertisement