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:uniq (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 be aware of in general.A more important bug I was also ignoring is that the length of the list of files may exceed
ARG_MAX. Since this is one of Ovid's test directories, I presume that's not actually that unlikely:).Reply to This
Parent
Re: (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