From owner-freebsd-questions@FreeBSD.ORG Wed Apr 19 20:41:06 2006 Return-Path: X-Original-To: questions@freebsd.org Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 83E2716A407 for ; Wed, 19 Apr 2006 20:41:06 +0000 (UTC) (envelope-from kyrreny@broadpark.no) Received: from osl1smout1.broadpark.no (osl1smout1.broadpark.no [80.202.4.58]) by mx1.FreeBSD.org (Postfix) with ESMTP id F186D43D6A for ; Wed, 19 Apr 2006 20:40:57 +0000 (GMT) (envelope-from kyrreny@broadpark.no) Received: from osl1sminn1.broadpark.no ([80.202.4.59]) by osl1smout1.broadpark.no (Sun Java System Messaging Server 6.1 HotFix 0.05 (built Oct 21 2004)) with ESMTP id <0IXZ00113LG5KR00@osl1smout1.broadpark.no> for questions@freebsd.org; Wed, 19 Apr 2006 22:40:53 +0200 (CEST) Received: from urban.broadpark.no ([80.203.212.30]) by osl1sminn1.broadpark.no (Sun Java System Messaging Server 6.1 HotFix 0.05 (built Oct 21 2004)) with ESMTP id <0IXZ0012WLG3WH10@osl1sminn1.broadpark.no> for questions@freebsd.org; Wed, 19 Apr 2006 22:40:53 +0200 (CEST) Date: Wed, 19 Apr 2006 22:40:55 +0200 From: Kyrre Nygard In-reply-to: <20060418133300.72079.qmail@web81605.mail.mud.yahoo.com> To: backyard1454-nospam@yahoo.com Message-id: <7.0.1.0.2.20060419223831.0210ea10@broadpark.no> MIME-version: 1.0 X-Mailer: QUALCOMM Windows Eudora Version 7.0.1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT References: <7.0.1.0.2.20060418150817.02110d10@broadpark.no> <20060418133300.72079.qmail@web81605.mail.mud.yahoo.com> Cc: questions@freebsd.org Subject: Re: Text files going double lined X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Apr 2006 20:41:07 -0000 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