From owner-freebsd-questions@FreeBSD.ORG Tue Jan 29 20:01:51 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D64C5380 for ; Tue, 29 Jan 2013 20:01:51 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx02.qsc.de (mx02.qsc.de [213.148.130.14]) by mx1.freebsd.org (Postfix) with ESMTP id 9E7CD2FF for ; Tue, 29 Jan 2013 20:01:51 +0000 (UTC) Received: from r56.edvax.de (port-92-195-8-191.dynamic.qsc.de [92.195.8.191]) by mx02.qsc.de (Postfix) with ESMTP id 979702780C; Tue, 29 Jan 2013 21:01:43 +0100 (CET) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id r0TK1kwS002163; Tue, 29 Jan 2013 21:01:46 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Tue, 29 Jan 2013 21:01:46 +0100 From: Polytropon To: "Ralf Mardorf" Subject: Re: How to fix a broken owner for files from world & build from ports? Message-Id: <20130129210146.3745269e.freebsd@edvax.de> In-Reply-To: References: <20130128182726.42db0712.freebsd@edvax.de> <510736DE.4060701@gmail.com> Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2013 20:01:51 -0000 On Tue, 29 Jan 2013 03:54:55 +0100, Ralf Mardorf wrote: > On Tue, 29 Jan 2013 03:41:34 +0100, Joshua Isom wrote: > > On 1/28/2013 7:56 PM, Ralf Mardorf wrote: > >> Still not perfect, I guess I need something similar to ls -RAl for some > >> directories :S and I didn't test what awk will do with names including a > >> space. > > > > Try `find /dir -ls`. You can pipe it into sed like this `find /dir -ls| > > sed -e 's%/dir%%g'` and then get something easily comparable. > > Cool, it does display the path, but there's still the other issue: > > $ touch test\ test > $ find * -ls| sed -e 's%/dir%%g'| awk '{print $5" "$11}' > rocketmouse test > > Perhaps awk isn't that important, but it e.g. will filter different file > sizes, for e.g. configurations I edited in the meantime. A thing regarding awk: For extended formatting, use the printf() command which works the same as in sh and C, os if you need, you can do things like printf "%s '%s'", $1, $2; Also note that you can have a custom delimiter for parsing the input, e. g. -F ":" (if you would generate input lists in :-separated CSV format). Additionally, it seems you're running into the fun of spaces in file names. Even though you can put them there, it doesn't imply it's good to do it. Spaces are separators (for commands and options), and everytime they're _not_ (e. g. when they appear in file names), you need to care for this fact, by escaping or quoting them. Maybe those articles by David A. Wheeler are interesting to you to learn about this annoyance for people writing short shell scripts to automate tasks: Filenames and Pathnames in Shell: How to do it correctly http://www.dwheeler.com/essays/filenames-in-shell.html Fixing Unix/Linux/POSIX Filenames: Control Characters (such as Newline), Leading Dashes, and Other Problems http://www.dwheeler.com/essays/fixing-unix-linux-filenames.html -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...