remove trailing spaces from _many_ files





10
Date Submitted Thu. May. 11th, 2006 10:19 AM
Revision 3 of 3
Helper jbuchberger
Tags BATCH | Java
Comments 2 comments
Java properties files can yield undesirable results at runtime, if there happen to be spaces at the end of some lines.

Requires a win32 port for the GNU utilities grep and sed - e.g. http://unxutils.sourceforge.net/.

rem   removes all trailing spaces from each file iterated,
rem   and saves them into subfolder "trimmed".
rem
rem   here all files in the current directory, with
rem   extension "properties" and trailing spaces inside, get
rem   matched for the loop
rem
rem   NOTE: requires grep and sed on the PATH, use
rem   http://unxutils.sourceforge.net/ for example
 
mkdir trimmed

for /F "usebackq" %%f in (`grep -l -e " $" *.properties`) do sed -e "s/ *$//" %%f > trimmed\%%f
 

Joerg Buchberger

Comments

Comments Properties files in XML
Thu. Sep. 21st, 2006 9:50 PM    Beginner java_junkie
Comments in case of Java properties...
Thu. May. 11th, 2006 10:42 AM    Helper jbuchberger

Voting