From owner-freebsd-questions@FreeBSD.ORG Tue Feb 24 16:35:03 2004 Return-Path: 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 A280916A4CE for ; Tue, 24 Feb 2004 16:35:03 -0800 (PST) Received: from priv-edtnes40.telusplanet.net (outbound05.telus.net [199.185.220.224]) by mx1.FreeBSD.org (Postfix) with ESMTP id 42B3C43D2D for ; Tue, 24 Feb 2004 16:35:03 -0800 (PST) (envelope-from cpressey@catseye.mine.nu) Received: from catseye.biscuit.boo ([206.116.63.24]) by priv-edtnes40.telusplanet.netSMTP <20040225003502.VBGV15975.priv-edtnes40.telusplanet.net@catseye.biscuit.boo>; Tue, 24 Feb 2004 17:35:02 -0700 Date: Tue, 24 Feb 2004 16:40:04 -0800 From: Chris Pressey To: mathias@haas.se Message-Id: <20040224164004.11f27d1d.cpressey@catseye.mine.nu> In-Reply-To: <51804.193.14.163.194.1077641809.squirrel@mail.haas.se> References: <51804.193.14.163.194.1077641809.squirrel@mail.haas.se> Organization: Cat's Eye Technologies X-Mailer: Sylpheed version 0.9.9 (GTK+ 1.2.10; i386-portbld-freebsd4.9) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit cc: questions@freebsd.org Subject: Re: Shell scripting woes X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Feb 2004 00:35:03 -0000 On Tue, 24 Feb 2004 17:56:49 +0100 (CET) mathias@haas.se wrote: > Hello guys! I have two questions about shellscripts: Your second question seems to have been addressed, so here's something for your first question... > 1) I have a backup job that 'tar's a lot of files and currently I > redirect all output of the job to a log. Tar unfortunately lists all > directories that it goes through, even if nothing is 'tar'ed in those > directories. So my logfile contains all my directories. I want to > filter out all lines in my tar-log that ends with slash ("/") since > those are directories. I want to sort of do an inverse grep on the > last character when tarring. Like: tar -cvf myback.tar |grep -v "all > lines that end with slash" > log.txt. All files that are backed up > contain the whole directory path (that's how I want it) - so I can't > simply do a reverse grep for the slash-char. Maybe you could do > something with awk? I'm a total rookie with awk, so I'm lost there... Try tar -cvf myback.tar | grep -v '/$' The $ in the grep pattern indicates "end of line". -Chris