|Subject:||Re: [PATCH] filter ls output by filetype|
|Date:||Fri, 29 Nov 2013 02:09:09 +1100|
On 11/28/2013 01:49 PM, Hal Ashburner wrote:3 at least would be handled by filtering outside ls,
> but obviously such things are not ls and lose the familiar and consistent ls options such as find displaying a differing long format, no colored output, sorting, control of display of dotfiles etc. However all of these alternatives' shortcomings can be alleviated with fairly ordinary shell pipelines involving sed and/or test at the cost of a simple, robust and convenient user interface as provided by ls.
> Shortcomings/BUGS/Possible future enhancements :
> 1) doesn't work with -R for anything except directories
> 2) Doesn't have a mode to filter based on permissions (eg show only executables or setuid etc).
> 3) Doesn't follow symbolic links and then filter them based on the type of file they are pointing at and I haven't yet worked out how to add the command interface for "including symlinks to" in a way that is not too ugly.
> 4) Others that exist of which I haven't considered.
by leveraging the --classify option.
ls --color -lF | sed -n 's#/$##p'
|[Prev in Thread]||Current Thread||[Next in Thread]|