How to fix a broken owner for files from world & build from ports?

Polytropon freebsd at edvax.de
Tue Jan 29 20:01:51 UTC 2013


On Tue, 29 Jan 2013 03:54:55 +0100, Ralf Mardorf wrote:
> On Tue, 29 Jan 2013 03:41:34 +0100, Joshua Isom <jrisom at 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, ...


More information about the freebsd-questions mailing list