Date: Tue, 29 Jan 2013 21:01:46 +0100 From: Polytropon <freebsd@edvax.de> To: "Ralf Mardorf" <ralf.mardorf@rocketmail.com> Cc: freebsd-questions@freebsd.org 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: <op.wrnjptnuuwjkcr@freebsd> References: <op.wrms0fqkqhadp0@freebsd> <20130128182726.42db0712.freebsd@edvax.de> <op.wrnfetnauwjkcr@freebsd> <op.wrngzye9uwjkcr@freebsd> <510736DE.4060701@gmail.com> <op.wrnjptnuuwjkcr@freebsd>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 29 Jan 2013 03:54:55 +0100, Ralf Mardorf wrote: > On Tue, 29 Jan 2013 03:41:34 +0100, Joshua Isom <jrisom@gmail.com> 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, ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130129210146.3745269e.freebsd>