NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
uniq (Score:1)
Re: (Score:2)
"ls... glob" FAIL. Please don't do that.
Re: (Score:2)
Re: (Score:1)
The other point, that filenames can contain special characters, I was aware of, but I tend to assume that 'my' files won't (unless I know that they do). If I were working on some arbitrary set of files I would have done the job in Perl (I was going to say
find -print0and{sort,uniq} -zwould work, but apparently (my)uniqdoesn't have a-zoption. Weird.). Thanks for the correction, though, since it's important to beRe:uniq (Score:1)
That won’t do what you wanted because
echowill output the whole shebang on a single line. What you want instead isBut then that still won’t do what you wanted, because you aren’t chopping the base path off the file names, so no two lines will have the same content anyway. You need to something like this:
Of course, as mentioned, that doesn’t account for the possibility of newlines in file names. And trying to do so is awkward since not all Unix utilities have switches to enable null- rather than newline-terminated records,
uniqandcutamong them.Reply to This
Parent