[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ls options: accept stdin, and list files except for...
From: |
Richard Dawe |
Subject: |
Re: ls options: accept stdin, and list files except for... |
Date: |
Sun, 14 Sep 2003 20:15:42 +0100 |
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/ ]
- ls options: accept stdin, and list files except for..., Dan Heller, 2003/09/14
- Re: ls options: accept stdin, and list files except for...,
Richard Dawe <=
- Re: ls options: accept stdin, and list files except for..., Dan Heller, 2003/09/15
- Re: ls options: accept stdin, and list files except for..., Richard Dawe, 2003/09/15
- Re: ls options: accept stdin, and list files except for..., Dan Heller, 2003/09/16
- Re: ls options: accept stdin, and list files except for..., Richard Dawe, 2003/09/16
- Re: ls options: accept stdin, and list files except for..., Dan Heller, 2003/09/16
- Re: ls options: accept stdin, and list files except for..., Richard Dawe, 2003/09/17
- Re: ls options: accept stdin, and list files except for..., Dan Heller, 2003/09/17
- du and wc should be able to read arguments from a file, Jim Meyering, 2003/09/18
- Re: du and wc should be able to read arguments from a file, Bernd Jendrissek, 2003/09/18
- Re: du and wc should be able to read arguments from a file, Bob Proulx, 2003/09/19