Recursively "trim trailing spaces?"

Recursively "trim trailing spaces?"

2
NewbieNewbie
2

    Nov 01, 2004#1

    Hello All,

    Is it possible to trim all trailing spaces from a group of files in a directory recursively?

    In other words, I have a directory with several thousand files that have a fixed width of 120 bytes; however, each file is padded with spaces at the end of the line. Does UltraEdit posses a feature that would do this automatically, or is it possible to create a macro to do this? (If a macro is the answer, where would I start?) Or would regular expression be the way to go?

    Thanks in advance,

    Shawn

    206
    MasterMaster
    206

      Nov 01, 2004#2

      I don't have time to play with it, but I'd first try a regular expression replace in files - something like "find all occurrences of the end of a line which are preceded by one or more spaces and replace with nothing"
      Software For Metalworking
      http://closetolerancesoftware.com

      2
      NewbieNewbie
      2

        Nov 02, 2004#3

        Thanks for the hint mrainey56!

        My solution (as you guessed) was as follows:

        I used UltraEdit's "Replace in Files" with the following items:

        Find: " ++$" Without the quotes
        Replace With: Empty
        In Files/Types: *.*
        Directory: C:\etc...
        Regular Expressions: Checked
        Search Subdirectories: Checked

        This regular expression removed the trailing spaces from each line in every file in the directory that I specified.