Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

html- replace all line breaks with \n

  • 05-04-2004 11:43AM
    #1
    Registered Users, Registered Users 2 Posts: 252 ✭✭


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


Comments

  • Closed Accounts Posts: 9,698 ✭✭✭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, Registered Users 2 Posts: 1,033 ✭✭✭buddy


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


  • Registered Users, Registered Users 2 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,698 ✭✭✭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, Registered Users 2 Posts: 252 ✭✭ConsultClifford


    Thanks all,
    Tnx Zaltais


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


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

    man I love Un*x, so many handy programmes


  • Registered Users, Registered Users 2 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, Registered Users 2 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
Advertisement