Thanx. Hadn't yet discovered GNU find's -printf option.
Still, my -f suggestion would be easier to type,
but I welcome your alternatives.
-Ken
> -----Original Message-----
> From: Bob Proulx [mailto:address@hidden
> Sent: Thursday, December 10, 2015 11:34 AM
> To: Nellis, Kenneth; address@hidden
> Subject: Re: bug#22128: dirname enhancement
>
> PƔdraig Brady wrote:
> > Nellis, Kenneth wrote:
> > > 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
>
> Also if using GNU find can use GNU find's -printf operand and %h to
> print the directory of the matching item. Not portable to non-gnu
> systems.
>
> find . -name xyz.dat -printf "%h\n"
>
> Can generate null terminated string output for further xargs -0 use.
>
> find . -name xyz.dat -printf "%h\0" | xargs -0 ...otherstuff...
>
> Bob