Text files going double lined
Kyrre Nygard
kyrreny at broadpark.no
Wed Apr 19 20:41:07 UTC 2006
At 15:33 18.04.2006, backyard1454-nospam at yahoo.com wrote:
>Stop wrinting code with notepad... If you search or
>perhaps within the handbook an elegant script file
>exists will fix your woes. Try searching in Gentoo
>forums and FreeBSD I can't remeber where I found it.
>The issue is unix uses carridge returns at the end of
>line. Windows uses carridge returns and line feeds.
>Unless your coders' editor allows you to stop this I
>would suggest the finding of this script to eliminate
>the extra line feed.
I use vim, or Notepad2 in Windows.
But hey this is not a carriage return problem.
You might like this though:
#!/usr/local/bin/bash
#
# Remove carriage returns and trailing whitespaces.
# $NINJA: text_clean.sh,v 1.0 2007/11/11 15:09:05 kyrre Exp $
#
for file in `find -s . -type f`; do
if file -b $file | grep -q 'text'; then
tr -d '\r' < $file | sed -E -e 's/[[:space:]]+$//' > $file.tmp
mv -f $file.tmp $file
echo "$file: Done"
fi
done
Regards,
Kyrre
More information about the freebsd-questions
mailing list