From owner-freebsd-questions@FreeBSD.ORG Thu Mar 30 14:59:57 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 3F71916A41F for ; Thu, 30 Mar 2006 14:59:57 +0000 (UTC) (envelope-from vaaf@broadpark.no) Received: from osl1smout1.broadpark.no (osl1smout1.broadpark.no [80.202.4.58]) by mx1.FreeBSD.org (Postfix) with ESMTP id 073DC43D77 for ; Thu, 30 Mar 2006 14:59:49 +0000 (GMT) (envelope-from vaaf@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 <0IWY00F6F4B6Q6A0@osl1smout1.broadpark.no> for questions@freebsd.org; Thu, 30 Mar 2006 16:59:30 +0200 (CEST) Received: from urban.broadpark.no ([213.187.181.70]) by osl1sminn1.broadpark.no (Sun Java System Messaging Server 6.1 HotFix 0.05 (built Oct 21 2004)) with ESMTP id <0IWY000114B6XG90@osl1sminn1.broadpark.no> for questions@freebsd.org; Thu, 30 Mar 2006 16:59:30 +0200 (CEST) Date: Thu, 30 Mar 2006 16:59:36 +0200 From: Vaaf To: questions@freebsd.org Message-id: <7.0.1.0.2.20060330165636.020cc010@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 Cc: Subject: ASCII files becoming 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: Thu, 30 Mar 2006 14:59:57 -0000 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