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

html- replace all line breaks with \n

Options
  • 05-04-2004 11:43am
    #1
    Registered Users Posts: 252 ✭✭


    anyone know any utility/software that will replace all line breaks with \n for me please????


Comments

  • Closed Accounts Posts: 9,700 ✭✭✭tricky D


    textpad allows you to save text files in Mac (\r), Unix (\n) or Windows (\r\n) formats
    http://www.textpad.com/
    hth
    \r


  • Registered Users Posts: 1,031 ✭✭✭buddy


    Aren't line breaks? <br> or <br />


  • Registered Users Posts: 358 ✭✭Philbert


    Not too sure if this is what youre looking for but if a simple "find and replace" utility will do the job then this is what you need.


  • Closed Accounts Posts: 304 ✭✭Zaltais


    I'm assuming the original poster actually want's to change end of lines to a literal '\n' (as in the printed characters rather than 'a line break'

    It's pish easy to do with a regex - you could do it a number of ways - my personal preference would be a dirty little perl script, but you could also do it in PHP, ASP, or even JavaScript - as for a 'proggie' that'll do it - you want a find and replace program that supports regex's - Dreamweaver's Find and Replace function actually has pretty good regex support, as does EditPlus. Don't know about TextPad but I'm sure it does too.


  • Closed Accounts Posts: 9,700 ✭✭✭tricky D


    Textpad does it at the save dialog. DW and EP2 do it as at kinda preference level which is also nice.
    Also if it is just a bare bones prog you're seeking as Zaltais mentions, then the textpad site has 3 fairly neat dos batchers which only do these conversions
    Convert = 3 programs to batch convert files between DOS, MAC and UNIX. For example, type "ToUnix *.HTML" to convert all your DOS & MAC files before uploading them to your UNIX web server. (56KB)
    page: http://www.textpad.com/add-ons/index.html]


  • Advertisement
  • Registered Users Posts: 252 ✭✭ConsultClifford


    Thanks all,
    Tnx Zaltais


  • Registered Users Posts: 1,865 ✭✭✭Syth


    sed 's/<\/*[Bb][Rr]>/\\n/g' filename

    man I love Un*x, so many handy programmes


  • Registered Users Posts: 1,967 ✭✭✭Dun


    Or if you're working in windows and you've Word installed, and don't want to install anything else, you can use it's Replace (ctrl+h) function (Find: ^p Replace: \n).


  • Closed Accounts Posts: 7,488 ✭✭✭SantaHoe


    Originally posted by Dun
    Or if you're working in windows and you've Word installed, and don't want to install anything else, you can use it's Replace (ctrl+h) function (Find: ^p Replace: \n).
    Actually I hadn't noticed it until now, but plain ol' notepad also has a find & replace feature (win2k).


  • Registered Users Posts: 1,967 ✭✭✭Dun


    Yeah, it's handy, but I don't know any (easy) way of replacing the likes of carriage returns with it.


  • Advertisement
Advertisement