I work a lot with php and a common problem with that is that some editors add an extra space or two to the end of the file and that causes errors on the website. All that is needed to fix that is to edit the file and remove the spaces at the end of it. Is there a way to do this from within DO?
You could make Opus call a VBScript or sed (a command-line text processor from the Unix world) script to do this.
I'm not sure exactly what you want to do though. Do you want to remove all lines at the end of the file which are either empty or have whitespace, or just the whitespace from the last line, or just the empty lines at the end of the file, or something else?
I've made an Opus button which runs sed to remove the empty lines from the end of the file (and reminded myself why I really, really hate sed in the process ) but I'm not sure if it's exactly what you want so I'll hold off posting it for now.
This isn't an answer to the question at hand but FWIW I use NoteTab Pro for all my text editing and it has an option to strip all trailing spaces at the end of the lines upon saving the file. Over the years that has saved me countless problems similar to the one you're dealing with.
there is a freeware version of NoteTab available however I do not know if the freeware one will strip trailing spaces ot not. might be worth a look however, the NoteTab site is: notetab.com/
Almost any editor worth it's salt has a 'trim trailing spaces' option like that which JohnZ mentioned (Hi John )... You might want to take a look to see if your editor or some other worthy freeware editors out there like Johns, or Notepad++ allows a command line arg to run such macro processing against files...
But I guess it's still unclear if 'thats' what you want vs. just blank lines at the end of the file, in which case Nudel should be able to hook you up with his sed script.
[quote="nudel"]You could make Opus call a VBScript or sed (a command-line text processor from the Unix world) script to do this.
I'm not sure exactly what you want to do though. Do you want to remove all lines at the end of the file which are either empty or have whitespace, or just the whitespace from the last line, or just the empty lines at the end of the file, or something else?
I've made an Opus button which runs sed to remove the empty lines from the end of the file (and reminded myself why I really, really hate sed in the process ) but I'm not sure if it's exactly what you want so I'll hold off posting it for now.[/quote]The files always end with the php delimiter ?>
There is usually a single space right after the > and a blank line following that. Both of those need to be removed. I've used sed before but the "fun"of it caused me stay away. If the script you have will do something like that, I would surely appreciate seeing it since I dread the thought of working through that.
As for the editor, I appreciate the suggestions but it isn't my editor that is doing it. I work on these files for others and each seems to use a different editor, which I can't control. Some files come in fine and some don't. But I can't work on them until they are stripped of the spaces.