Re: [PATCH][2.5] quotemarks and trailing whitespaces (1st, revisited)

From: Padraig Brady (
Date: Mon Jun 24 2002 - 09:53:03 EST

Pavel Machek wrote:
> Hi!
>>I redid the quotemark patch. Since I'm a lazy typist, I had a script which
>>removed all whitespaces before virtual or real newline characters. Does
>>this one look OK to you?
> Perhaps such patch should go to scripts/ in distribution, so when
> someone finishes big cleanup for driver can run it at the same time?
> Pavel

This thread is probably of interest.
It was just when 2.5.0 came out since I thought it was the
most appropriate time for something like this.
Anyway the simple script I used is attached.
Note for 2.5.0 it removed 224,654 bytes.


# Remove trailing whitespace. By default it runs
# in the current directry, on all files, but you
# can change this by passing parameters as you
# would to find.
# Note this doesn't change file (timestamps)
# which don't need to be updated.

#Note super sed has a -i option to do this (edit files in place)
#also perl can edit files in place easily.

# Temporary file

find "$@" -type f -print |
while read file
    echo -n "editing $file: "
    if test -s $file; then
       sed -e 's/[ ]*$//g' <$file > $temp
       if test -s $temp; then
           if cmp -s $file $temp; then
             echo -n "file not changed: "
             cp $temp $file
           echo "done"
           echo "produced an empty file - aborting"
       echo "original file is empty."
echo "all done"
rm -f $temp

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Sun Jun 30 2002 - 22:00:07 EST