From owner-freebsd-questions@FreeBSD.ORG Mon Feb 13 18:17:04 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 7E5E916A420 for ; Mon, 13 Feb 2006 18:17:04 +0000 (GMT) (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 0E19143D82 for ; Mon, 13 Feb 2006 18:16:47 +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 <0IUN00AO81FYJSA0@osl1smout1.broadpark.no> for questions@freebsd.org; Mon, 13 Feb 2006 19:16:46 +0100 (CET) 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 <0IUN003NE1FW6100@osl1sminn1.broadpark.no> for questions@freebsd.org; Mon, 13 Feb 2006 19:16:46 +0100 (CET) Date: Mon, 13 Feb 2006 19:16:44 +0100 From: Kristian Vaaf In-reply-to: <43F070BA.1000205@meijome.net> To: Norberto Meijome Message-id: <7.0.1.0.2.20060213191304.0219b820@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.20060213094752.021a8eb0@broadpark.no> <43F070BA.1000205@meijome.net> 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 18:17:04 -0000 At 12:42 13.02.2006, Norberto Meijome wrote: >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. I think I will look out for a more elegant approach :) If I fail to find one, I will use your suggestion. Thanks though, it kinda taught me a thing or two about shell programming. All the best, Fafa