From owner-freebsd-questions@FreeBSD.ORG Tue Jun 27 13:19:39 2006 Return-Path: X-Original-To: freebsd-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 25E8B16A400 for ; Tue, 27 Jun 2006 13:19:39 +0000 (UTC) (envelope-from nospam@mgedv.net) Received: from mail.mgedv.net (mail.mgedv.net [81.223.168.230]) by mx1.FreeBSD.org (Postfix) with ESMTP id 21D5443D8F for ; Tue, 27 Jun 2006 13:19:22 +0000 (GMT) (envelope-from nospam@mgedv.net) Received: from metis (sslint.my.loop [1.1.1.1]) by mail.my.loop (mgedv) with ESMTP id E0F8F457A0; Tue, 27 Jun 2006 15:19:20 +0200 (CEST) From: "no@spam@mgedv.net" To: , Date: Tue, 27 Jun 2006 15:19:20 +0200 Message-ID: <000501c699ec$4d104000$01010101@avalon.lan> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <44A11E2D.3010006@att.net> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Thread-Index: AcaZ4jUmrolfPEt1Qc6PfiCN69IBLwACYhjw Cc: Subject: RE: need help w/ simple bash script 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: Tue, 27 Jun 2006 13:19:39 -0000 > -----Original Message----- > From: owner-freebsd-questions@freebsd.org > [mailto:owner-freebsd-questions@freebsd.org] On Behalf Of dw > Sent: Tuesday, June 27, 2006 2:02 PM > To: freebsd-questions@freebsd.org > Subject: need help w/ simple bash script > > Hi all, > > I am trying to write a simple bash script that will collate > pkg_version > reports from all of my servers to generate centralized HTML > reports. To > format the output, I am trying: > > # REPORT=`pkg_version -v` > > But when I "echo $REPORT", I get: > > Xaw3d-1.5E_1 = up-to-date with port apr-db42-1.2.7_1 = > up-to-date with > port autoconf-2.13.000227_5 = up-to-date with port autoconf-2.59_2 = > up-to-date with port automake-1.9.6 = up-to-date with port > bash-3.1.17 = > up-to-date with port cvsup-without-gui-16.1h_2 = up-to-date with port > db41-4.1.25_3 = up-to-date with port............................. > > When what I want is: > > Xaw3d-1.5E_1 = up-to-date with port > apr-db42-1.2.7_1 = up-to-date with port > autoconf-2.13.000227_5 = up-to-date with port > autoconf-2.59_2 = up-to-date with port > automake-1.9.6 = up-to-date with port > bash-3.1.17 = up-to-date with port > cvsup-without-gui-16.1h_2 = up-to-date with port > db41-4.1.25_3 = up-to-date with port > ... > ... > ... > > > I've also tried: > > for LINE in `pkg_version -v`; do echo $LINE; done > > but that's even worse; then I get: > > Xaw3d-1.5E_1 > = > up-to-date > with > port > apr-db42-1.2.7_1 > = > up-to-date > with > port > autoconf-2.13.000227_5 > = > up-to-date > with > port > autoconf-2.59_2 > = > up-to-date > with > port > ... > ... > ... > > I know I figured out a technique once before, but I'm banging my head > against a wall right now. Thanks for any help. > > -DW > > > why not just try pkg_version -v |while read h_line do echo "$h_line" >TO SOMEWHERE done; you'd be even able to do something like pkg_version -v |grep -v 'up-to-date with port'|while read h_line do blah.... done; have fun ;-)