From owner-freebsd-questions@FreeBSD.ORG Mon Feb 13 11:43:01 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 D0D3216A420 for ; Mon, 13 Feb 2006 11:43:01 +0000 (GMT) (envelope-from freebsd@meijome.net) Received: from sigma.octantis.com.au (ns2.octantis.com.au [207.44.189.124]) by mx1.FreeBSD.org (Postfix) with ESMTP id E4C7D43D6B for ; Mon, 13 Feb 2006 11:42:59 +0000 (GMT) (envelope-from freebsd@meijome.net) Received: (qmail 12110 invoked from network); 13 Feb 2006 22:42:59 +1100 Received: from 203-217-43-43.dyn.chime.net.au (HELO ?192.168.13.3?) (203.217.43.43) by sigma.octantis.com.au with (DHE-RSA-AES256-SHA encrypted) SMTP; 13 Feb 2006 22:42:58 +1100 Message-ID: <43F070BA.1000205@meijome.net> Date: Mon, 13 Feb 2006 22:42:50 +1100 From: Norberto Meijome User-Agent: Thunderbird 1.5 (X11/20060206) MIME-Version: 1.0 To: Kristian Vaaf References: <7.0.1.0.2.20060213094752.021a8eb0@broadpark.no> In-Reply-To: <7.0.1.0.2.20060213094752.021a8eb0@broadpark.no> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: questions@freebsd.org Subject: Re: How to ensure one blank line on top of ASCII files? 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: Mon, 13 Feb 2006 11:43:02 -0000 Kristian Vaaf wrote: > > Hello! > > I need to make sure all my ASCII files start with one blank line. > > I just need to know what command to use, > I've written the rest of the script to do this for me: > > -- > echo "" > MY_BLANK_LINE.txt > for file in `find -s . -type f -not -name ".*"`; do > > if file -b "$file" | grep -q 'text'; then > mv $file $file.tmp cat MY_BLANK_LINE.txt $file.tmp >> $file rm -f $file.tmp > echo "$file: Done" > > fi > > done rm -f MY_BLANK_LINE.txt There possibly are far more elegant solutions...but that should work.