From owner-freebsd-questions@FreeBSD.ORG Thu Feb 24 19:03:45 2005 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 7F4F516A4CE for ; Thu, 24 Feb 2005 19:03:45 +0000 (GMT) Received: from post-22.mail.nl.demon.net (post-22.mail.nl.demon.net [194.159.73.192]) by mx1.FreeBSD.org (Postfix) with ESMTP id F049743D2D for ; Thu, 24 Feb 2005 19:03:44 +0000 (GMT) (envelope-from FreeBSD@amadeus.demon.nl) Received: from amadeus.demon.nl ([82.161.18.200]:62890 helo=[10.0.1.1]) by post-22.mail.nl.demon.net with esmtp (Exim 4.43) id 1D4OH1-0007i5-Oi; Thu, 24 Feb 2005 19:03:43 +0000 In-Reply-To: <4c90b772050224033921bd036b@mail.gmail.com> References: <20050223214010.GA31005@asu.edu> <20050223221926.GB69249@slackbox.xs4all.nl> <20050224023605.GD31005@asu.edu> <20050224034132.GE3123@guinness.local.mark-and-erika.com> <4c90b772050224033921bd036b@mail.gmail.com> Mime-Version: 1.0 (Apple Message framework v619.2) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: FreeBSD questions mailing list Date: Thu, 24 Feb 2005 20:03:44 +0100 To: freebsd X-Mailer: Apple Mail (2.619.2) cc: David Bear Subject: Re: awk print 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: Thu, 24 Feb 2005 19:03:45 -0000 On 24 feb 2005, at 12:39, Soheil Hassas Yeganeh wrote: > You can set $[1..n] to "" and then print > find ./ -name "stuff" | awk '{ $1=""; $2=""; print} > > > On Wed, 23 Feb 2005 22:41:32 -0500, Mark Frank > wrote: >> * On Wed, Feb 23, 2005 at 07:36:05PM -0700 David Bear wrote: >>> On Wed, Feb 23, 2005 at 11:19:26PM +0100, Roland Smith wrote: >>>> On Wed, Feb 23, 2005 at 02:40:10PM -0700, David Bear wrote: >>>>> I'm using awk to parse a directory listing. I was hoping there is a >>>>> way to tell awk to print from $2 - to the end of the columns >>>>> available. >>>>> >>>>> find ./ -name '*stuff' | awk '{FS="/" print $3---'} >>>> >>>> Is this what you mean?: >>>> >>>> find ./ -name '*stuff'|sed 's|\.[^/]*/[^/]*/||g' >>> >>> thanks for the advice. No, this doesn't do what I want. >>> >>> If I have a directory path /stuff/stuff/more/stuff/more/and/more >>> that is n-levels deep, I want to be able to cut off the first two >>> levels and print the from 2 to the Nth level. >> >> So how about cut? >> >> find ./ -name '*stuff'| cut -d/ -f4- >> >> Mark or if you insist on using awk: find ./ -name '*stuff' | awk '{for (i=3; i<=NF; i++) printf " %s", $i; printf "\n" }' Arno