Find the answer to your Linux question:
Results 1 to 2 of 2
I am wondering about what's the best and easiest way to strip trailing whitespace from every single file in a folder, recursively. I want to write a program/script so that ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Nov 2004
    Posts
    208

    QUERY: strip trailing whitespace ... woes :S


    I am wondering about what's the best and easiest way to strip trailing whitespace from every single file in a folder, recursively.

    I want to write a program/script so that you pass in a folder name and it'll recursively go through all sub-folders and strips trailing whitespace from every single file.

    Trailing whitespace includes:

    1. whitespaces at end of text lines, strip whitespace but retain text
    2. whitespaces on empty lines, strip whitespace but leave the empty line

  2. #2
    Just Joined!
    Join Date
    Oct 2005
    Posts
    31

    AWK the Awold Angels sing!

    I wish I could give you exact source, but I do not know enough about awk. I just know that if I were faced with this dilema I would program my solution in awk.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •