Date: Wed, 19 Apr 2006 22:40:55 +0200 From: Kyrre Nygard <kyrreny@broadpark.no> To: backyard1454-nospam@yahoo.com Cc: questions@freebsd.org Subject: Re: Text files going double lined Message-ID: <7.0.1.0.2.20060419223831.0210ea10@broadpark.no> In-Reply-To: <20060418133300.72079.qmail@web81605.mail.mud.yahoo.com> References: <7.0.1.0.2.20060418150817.02110d10@broadpark.no> <20060418133300.72079.qmail@web81605.mail.mud.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
At 15:33 18.04.2006, backyard1454-nospam@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7.0.1.0.2.20060419223831.0210ea10>
