fix source code in dreamweaver that is double spaced

I have some scripts that keep getting double spaced due to someone elses FTP program. I have asked them to stop using it but it's already affected many files and it's too late to go back into the old versions of the code because we've committed these spaces to our repository due to time restrictions.

How can I single space the file easily in dreamweaver. I'm willing to use another utility if necessary.
LVL 2
MeridianManagementAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jason C. LevineNo oneCommented:
Hi MeridianManagement,

You can do Commands | Apply Source Formatting to fix excessive whitespace.
0
MeridianManagementAuthor Commented:
doesn't seem to fix php...
0
Jason C. LevineNo oneCommented:
Hmph, it apparently doesn't.  Are these pages just PHP code or mixed PHP and HTML?

0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

MeridianManagementAuthor Commented:
mixed. There is also a lot of javascript files with the same issue.
0
Jason C. LevineNo oneCommented:
Okay.

The reason this happened is that the other user has a different line-break method set than you do.    DW probably isn't the best tool for this because you would need to run a Find and Replace on two blank lines in Source Code mode and I can see that not working as expected.

Go grab NotePad++ as it has an option to remove blank lines under its TextFX | TextFX Edit menu.
0
MeridianManagementAuthor Commented:
Thanks Jason,

That's definitely a pretty close solution. I was hoping it would be possible to only replace every other line (not everyone empty line), because technically there are some line breaks for a reason. If you can think of anything let me know
0
Jason C. LevineNo oneCommented:
You can apply the Notepad++ solution selectively.  So highlight the code that has the excessive line breaks and apply the TextFX.  It will only remove the line breaks from the selected area.
0
b0lsc0ttIT ManagerCommented:
MeridianManagement,

This might be something where a Regex could help too.  Does Notepad++ support those for a replace?   Can you provide a sample file so I can make sure I understand how the file is affected?  If Notepad++ won't work with a Regex then there are other programs that will although I am not sure of free ones that you can use.  I believe there are some but I would have to verify first.

The PSPad editor has a number of features too so it might also have an option to strip the extra lines and not be bothered by PHP.  Let me know if you want me to test and verify this but a sample file will help this.

Let me know if you have any questions or need more information.

b0lsc0tt
0
Jason C. LevineNo oneCommented:
b0lsc0tt,

Good points.  NotePad++ does support regex, as does DW but DW's regex interpreter is a little limited.

0
b0lsc0ttIT ManagerCommented:
If so, and without a sample to be sure, then you would need some a regex like the following for the test ...
\r\n\r\n
... and then in the replace you just provide a line break (i.e. hit the Enter key probably although I can provide characters if the program can convert them).
The thing I don't know for sure is if the file that is being read wrong actually has a carriage return and a new line character or just the new line character.  Most likely the former.  I have seen files "messed up" like this before but never bothered to spend the time to see why or try to fix them.  Homesite just corrects them in the display but it is annoying to have them messed up.
A sample will really help.  Also if you have a question trying to use the above then let me know about the program and choices you see.
bol
0
OpalelementCommented:
If you replace two newlines with one newline in dreamweaver find&replace, it should only take out every other line
0
Jason C. LevineNo oneCommented:
Opalelement,

That may or may not work as expected.  If another user opens the file in a different editor you may get different types of line breaks.  That's why b0lsc0tt suggested regex and I suggested Notepad++ because those options can handle \n\n \n\r or \r\n depending on how the other editor threw those in.  DW will handle a blank line in Find and Replace differently depending on which line break type is chosen in the options.
0
MeridianManagementAuthor Commented:
okay here's an example of a file. It was partially fixed in dreamweaver that's why some of the file looks okay.
0
MeridianManagementAuthor Commented:
Here you go, it didn't like the php extension
property-display.txt
0
b0lsc0ttIT ManagerCommented:
It is the \r\n that is used (i.e. a carriage return followed by the new line character).  In the match field (or its equivalent) use ...
\r\n\r\n
... and in the replace field you would either place ...
\r\n
... or just press Enter.  Now that will get rid of every occurence, except 4 in the case of your file above.  In that file it looks like 4 lines already had the double space so they actually have 3 line breaks now.  You could run it again if you want to get rid of them all but maybe you want to keep those.
Let me know how it works.  If Dreamweaver has a problem then I used a program called EditPad (actually the Pro version) to run it and it worked.  Let us know if you have a question.
bol
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
m_abdelfattahCommented:
This should be the solution :
1. Open Dreamweaver Preferences ( Edit -> Preferences ).
2. Select Code Format
3. Change Line break type to LF (UNIX)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Dreamweaver

From novice to tech pro — start learning today.