Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0
tag 22128 notabug
close 22128
stop
On 09/12/15 17:31, Nellis, Kenneth wrote:
> I frequently need to extract the `dirname's from a list of files,
> so dirname should have an option to take its input from a
> file, e.g.:
>
> dirname -f <filename>
xargs dirname < filename
> where <filename> could be "-" for stdin.
>
> E.g., to get a list of directories that contain a specific
> file:
>
> find -name "xyz.dat" | dirname -f -
find -name "xyz.dat" -print0 | xargs -r0 dirname
> The same would be good for `basename' as well.
xargs basename -a < filename
thanks,
Pádraig.