text formating utility - remove unwanted returns

Discussion in 'OT Technology' started by myhamster, Oct 2, 2005.

  1. myhamster

    myhamster New Member

    Joined:
    Sep 16, 2004
    Messages:
    128
    Likes Received:
    0
    Hi,
    I got this text file (Pride and Prejudice by Jane Austen), and it has carriage returns so that each line is fixed length when you open it with text pad, even if the window is maximized.

    I would like to remove the carriage returns so the window actually wraps the text. Does anyone know of any text utilities that woud do that?

    I've tridd downloading two progs, but they didn't do what I thought they did.

    Thanks!
    Eric
     
  2. WannaZO6

    WannaZO6 There are 10 types of people in the world, the one

    Joined:
    Feb 24, 2002
    Messages:
    1,005
    Likes Received:
    0
    Location:
    Richmond, VA
    write a macro in word that does it once, make another macro that runs the first one a bunch of times. assign it to a botton and start jerking it off till you get to the end of the document.
     
  3. Joe_Cool

    Joe_Cool Never trust a woman or a government. Moderator

    Joined:
    Jun 30, 2003
    Messages:
    299,245
    Likes Received:
    536
    What I do on those is to open them in word, using find & replace (ctrl-h) I replace all double spaces with 1 space (do it until there are 0 replacements), replace ^p ^p (two carriage returns separated by a space) with ^p^p, replace ^p^p^p with ^p^p (repeat until 0 replacements), replace ^p^p with <newline>, then replace all remaining ^p with a space. Last, I replace all <newline> with ^p^p.

    The initial stuff condenses whitespace, then you replace all multiple carriage returns with <newline> to mark paragraph breaks, convert all returns to spaces to get rid of the line breaks, then go back and put your paragraph breaks back in.

    Violin! You're done.

    I should script it in linux, but I haven't bothered. :mamoru:
     
  4. Yep

    Yep Knick knack paddy whack, give the old dog a bone

    Joined:
    Jan 22, 2001
    Messages:
    4,603
    Likes Received:
    0
    Location:
    South Jersey
    So, you just want to remove any and all carriage returns from a text file?

    I could write you a quick VBscript to do this. Let me know.
     
  5. crontab

    crontab (uid = 0)

    Joined:
    Nov 14, 2000
    Messages:
    23,441
    Likes Received:
    12
    Wonderin' why you would want to do that?

    Download dos2unix for windows. That utility removes carriage returns like its unix counterpart.

    Microsoft word has the capability to remove carriage returns as well.
     
  6. Joe_Cool

    Joe_Cool Never trust a woman or a government. Moderator

    Joined:
    Jun 30, 2003
    Messages:
    299,245
    Likes Received:
    536
    I don't think that's what he's after. If I understand correctly, he wants to convert an e-book from this:

    to this:
     
  7. ShapeShifterz

    ShapeShifterz Longtime Lurker

    Joined:
    Mar 15, 2000
    Messages:
    183
    Likes Received:
    0
    Location:
    Bay Area, CA
    If you have access to a *nix box, tr -d '\r' < file.txt > newfile.txt
     

Share This Page