<div dir="ltr">I like "find". I actually use the NUL-terminator feature that makes it work well with filenames that contain strange characters (like the newlines Scott mentions).<div><br></div><div>
<p class=""><span class="">$ find . -type f | xargs wc</span></p>
<p class=""><span class="">wc: ./absurd: open: No such file or directory</span></p>
<p class=""><span class="">wc: name: open: No such file or directory</span></p>
<p class=""><span class=""> 0 0 0 total</span></p>
<p class=""><span class="">$ find . -type f -print0 | xargs -0 wc</span></p>
<p class=""><span class=""> 0 0 0 ./absurd</span></p>
<p class=""><span class="">name</span></p>
<p class=""><span class="">$ </span></p></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 27, 2015 at 3:34 PM, Ted W. <span dir="ltr"><<a href="mailto:ted-lists@xy0.org" target="_blank">ted-lists@xy0.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I've always heard that you should use find in place of ls when the<br>
output must be parsed. In this case, find handles it all by itself.<br>
<br>
elw@xbook:~/test$ touch a.out A.out b.out B.out c.out C.out<br>
elw@xbook:~/test$ find . -name "[A-Z]*.out"<br>
./A.out<br>
./B.out<br>
./C.out<br>
elw@xbook:~/test$ find . -name "[a-z]*.out"<br>
./a.out<br>
./b.out<br>
./c.out<br>
<div class="HOEnZb"><div class="h5"><br>
On Wed, Aug 26, 2015 at 06:23:06PM -0400, DJ-Pfulio wrote:<br>
> I seem to recall being told to NEVER parse the output from ls - ever.<br>
> Maybe I misunderstood?<br>
><br>
> On 08/26/2015 05:38 PM, Jim Kinney wrote:<br>
> > Yeah. What he said.<br>
> > From my F22 bash-land (4.3.39):<br>
> > touch a.pdf A.pdf b.pdf B.pdf c.pdf C.pdf z.pdf Z.pdf<br>
> > [jkinney@dhcp061167 tmp]$ ls<br>
> > a.pdf A.pdf b.pdf B.pdf c.pdf C.pdf z.pdf Z.pdf<br>
> > [jkinney@dhcp061167 tmp]$ ls | grep "[A-Z].pdf"<br>
> > A.pdf<br>
> > B.pdf<br>
> > C.pdf<br>
> > Z.pdf<br>
> > [jkinney@dhcp061167 tmp]$ ls | grep "[a-z].pdf"<br>
> > a.pdf<br>
> > b.pdf<br>
> > c.pdf<br>
> > z.pdf<br>
> > On Wed, 2015-08-26 at 15:41 -0400, Ed Cashin wrote:<br>
> >> I've been biting my tongue here. I don't think these characteristics<br>
> >> of bash are congruent with UNIX philosophy. The people who made UNIX<br>
> >> complain about bash being bloated. These characteristics of bash are<br>
> >> congruent with POSIX philosophy.<br>
> >><br>
> >> A UNIX-ish way of doing this would be ...<br>
> >><br>
> >> ls | grep '^[A-Z].*\.pdf'<br>
> >><br>
> >><br>
> >> On Wed, Aug 26, 2015 at 1:41 PM, Jim Kinney <<a href="mailto:jim.kinney@gmail.com">jim.kinney@gmail.com</a>><br>
> >> wrote:<br>
> >>> Wow! Shopt has enough options to make it stand next to emacs.<br>
> >>> I don't understand why the default is essentially case insensitive<br>
> >>> when everything else in bash is case sensitive. It looks like the<br>
> >>> LANG makes it work that way but that makes no sense either to me. A<br>
> >>> != a in standard US English.<br>
> >>> More of the secret mysteries of Unix philosophy I've never wrapped<br>
> >>> my head around.<br>
> >>> On Aug 26, 2015 12:16 PM, "Scott Plante" <<a href="mailto:splante@insightsys.com">splante@insightsys.com</a>><br>
> >>> wrote:<br>
> >>>> I didn't know the globasciiranges option.<br>
> >>>><br>
> >>>> Another solution is the LC_COLLATE variable:<br>
> _______________________________________________<br>
> Ale mailing list<br>
> <a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
> <a href="http://mail.ale.org/mailman/listinfo/ale" rel="noreferrer" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
> See JOBS, ANNOUNCE and SCHOOLS lists at<br>
> <a href="http://mail.ale.org/mailman/listinfo" rel="noreferrer" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Ted Wood <<a href="mailto:ted-lists@xy0.org">ted-lists@xy0.org</a>><br>
Registered GNU/Linux user #413569<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" rel="noreferrer" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" rel="noreferrer" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"> Ed Cashin <<a href="mailto:ecashin@noserose.net" target="_blank">ecashin@noserose.net</a>></div></div>
</div>