ASCII files becoming double lined
Vaaf
vaaf at broadpark.no
Thu Mar 30 14:59:57 UTC 2006
Hello!
Sometimes I notice ASCII files becoming double lined.
As in there somehow appearing an empty line in between every line.
Why is this? And:
01 How can I detect files with double lines?
02 And then eliminate this double lining?
The goal would be to apply 01 and 02 to this script:
#!/usr/local/bin/bash
#
# Remove CRLF, trailing whitespace and blank lines.
# $MARBEJA: clean.sh,v 1.0 2007/11/11 15:09:05 awad Exp $
#
for file in `find -s . -type f`; do
if file -b "$file" | grep -q 'text'; then
echo >> "$file"
tr -d '\r' < "$file" \
| sed -E -e 's/[[:space:]]+$//' \
| cat -s - > "${file}.tmp" && mv -f "${file}.tmp" "$file"
echo "$file: Done"
fi
done
Thanks,
Vaaf
More information about the freebsd-questions
mailing list