On Sun, Mar 04, 2018 at 02:32:03PM -0800, Samuel Sieb wrote: > On 03/04/2018 11:43 AM, bruce wrote: > > > > I wanted to get the last X lines of each file from an input/wildcard > > list of files !! > > > > There were already at least two different solutions posted. > > tail -n 5 $(find /foo -name "*dog.dat") > find /foo -name "*dog.dat" -print0 | xargs -0 tail -n5 I'll add a third. Difference is printing of the filename. The two above depend on tail to print the name IF there are multiple arguments. If there is only one match by find or if xargs' last group no filename will be printed. This could be avoided by adding /dev/null to tail's arg list. The first solution above could exceed the system or shell's maximum command line length. ASolution where find prints the filename and calls a separate tail for each file is: find /foo -type f -name "*dog.dat" -print -exec tail -n 5 {} ';' Jon -- Jon H. LaBadie jonfu@xxxxxxxxxx _______________________________________________ users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx