Hello.

Dan Heller wrote:
> 
> intent (example):  list all files in a directory that aren't html files.
> 
>     $ ls --except *.html
> 
> I can obviously pipe ls though grep -v to get the result, but I can't put
> the result back into ls because ls doesn't accept stdin. Hence, this does
> not work:
> 
>     $ ls | grep -v .html | ls [OPTIONS]
> 
> I want the nicely formatted result that ls gives (w/appropriate formatting
> params), but from input not necessarily from the command line.

Again, xargs is your friend:

    ls | grep -v .html | xargs ls [OPTIONS]

You might want to use something more like this, though:

    find . ! -type d ! -name '*.html' | xargs ls [OPTIONS]

(Find all files that are not directories and not called '*.html'.)

Note that find & xargs can cope with filenames with spaces by using nul as the
separator. See the info docs for GNU findutils for details:

    info findutils

Regards,

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]


_______________________________________________
Bug-fileutils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-fileutils

Reply via email to