Computing.Net > Forums > Web Development > Putting Code on Single Line

Putting Code on Single Line

Reply to Message Icon

Original Message
Name: leli
Date: April 28, 2004 at 12:52:01 Pacific
Subject: Putting Code on Single Line
OS: WIN 2000 / WIN XP PRO / W
CPU/Ram: 512
Comment:

In desperate need of help,
Anyone know a program or a process within an already exsiting program that automatically places all your code on a single line.

Example:
fsdfsdfsdf
sdfsdfdsfsdfsdfsdfsdf
sfsdfsdfsdf
sfsdfsdfdsf

Want it to automatically format it to one single line:

Example:
ssdfsdfsdfafsdfsdfsdfsfsfsfsdfsdf

I am needing to do this as we are programming html, but need to be in single line to make it function properly, and it is quite time consuming to have do it by hand.

Thank you!



Report Offensive Message For Removal

Response Number 1
Name: safeTsurfa
Date: April 28, 2004 at 14:16:03 Pacific
Subject: Putting Code on Single Line
Reply: (edit)

For HTML you can do it two ways that I know work.

Firstly you could use HTMLCompact, which will remove all the excess content, including line feeds so everything is compacted into a long string of code as you want.

Alternatively, you can use TextEd, an advanced notepad replacement, and use Find....ReplaceAll to remove the line feeds (they are special characters defined as "CRLF" = Carriage Return Line Feed).

This second method would probably work equally well in Word, if you already have that. Just take care when you resave the document that it remains an HTML file.



Report Offensive Follow Up For Removal

Response Number 2
Name: leli
Date: April 28, 2004 at 16:46:36 Pacific
Subject: Putting Code on Single Line
Reply: (edit)

Thank you for the suggestion. I have downloaded the HTMLCompact, but it appears to only compress the entire page into a java enabled code, not place all the code on a single line. I have not been able to find the second program either online.

Please if anyone has any ideas or suggestions it would be much appreciated. Thank you!


Report Offensive Follow Up For Removal

Response Number 3
Name: safeTsurfa
Date: April 28, 2004 at 18:25:57 Pacific
Subject: Putting Code on Single Line
Reply: (edit)

TextEd is found here:
http://www.greenhousemm.com/site/products/texted/


Report Offensive Follow Up For Removal

Response Number 4
Name: safeTsurfa
Date: April 28, 2004 at 18:33:45 Pacific
Subject: Putting Code on Single Line
Reply: (edit)

Also try here:
http://www.varnus.com/site/downloads.htm

Apparently this is the latest version by the new company, 3.3 Gold. I haven't tried this version, but do use the one at the first link and know that version works well, right back to Windows 98SE.


Report Offensive Follow Up For Removal

Response Number 5
Name: Khalid
Date: April 29, 2004 at 01:59:03 Pacific
Subject: Putting Code on Single Line
Reply: (edit)

I have sent you an email with a program I have quickly written to remove line feed from a clipboard source.


Report Offensive Follow Up For Removal


Response Number 6
Name: leli
Date: April 29, 2004 at 11:26:24 Pacific
Subject: Putting Code on Single Line
Reply: (edit)

Thank you Kahlid for your program, I sent you an email regarding it. Unfortunately I can not get it to execute on my system. I go into more detail about the error in the email I sent to you.

I am still looking for someone to help me with this issue of tryinng to have my HTML code automatically format to one single line from a normal html page of code.

Thank you!


Report Offensive Follow Up For Removal

Response Number 7
Name: FishMonger
Date: May 3, 2004 at 08:35:16 Pacific
Subject: Putting Code on Single Line
Reply: (edit)

Here's a Perl command that will remove all of the "CRLF" in the file, and also create a backup copy of the original file. If you need to do this with a large number of files, we can write a short Perl script instead.

perl -pi.bak -e "s/[\n\r]+//" myfile.html

ActiveState Perl



Report Offensive Follow Up For Removal






Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Putting Code on Single Line

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software