Re: tail for a list of files

2018-03-04 Thread Jon LaBadie
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 -na

Re: tail for a list of files

2018-03-04 Thread R. G. Newbury
From: bruce Subject: Re: tail for a list of files On Sun, Mar 4, 2018 at 2:31 PM, Joe Zeff wrote: On 03/04/2018 11:15 AM, R. G. Newbury wrote: find . -name "*.pdf" | tail -n 2 does not 'find' the files in canonical order: it outputs 124.pdf and 126.pdf What does it pr

Re: tail for a list of files

2018-03-04 Thread Samuel Sieb
On 03/04/2018 01:07 PM, R. G. Newbury wrote: From: Joe Zeff On 03/04/2018 11:15 AM, R. G. Newbury wrote: find .  -name "*.pdf" | tail -n 2 does not 'find' the files in canonical order: it outputs 124.pdf and 126.pdf What does it print if you don't run it through tail? That exercise was left

Re: tail for a list of files

2018-03-04 Thread Samuel Sieb
On 03/04/2018 11:43 AM, bruce wrote: um.. hey guys I wanted to get the last X lines of each file from an input/wildcard list of files !! so.. I wanted the last 5 lines of the 126.pdf as well as the last 5 lines of the 125.pdf... --NOT the last X files from a list of files.. There were alr

Re: tail for a list of files

2018-03-04 Thread Samuel Sieb
On 03/04/2018 11:15 AM, R. G. Newbury wrote: I created 4 pdf files using 'touch 123.pdf' through '126.pdf' find .  -name "*.pdf" | tail -n 2 does not 'find' the files in canonical order: it outputs 124.pdf and 126.pdf The find command lists the files in whatever order the filesystem returns

Re: tail for a list of files

2018-03-04 Thread Joe Zeff
On 03/04/2018 01:07 PM, R. G. Newbury wrote: That exercise was left for those adventurous students with an inquiring mind to attempt and to ascertain the answer for themselves But for those without a computer to run the code or the intellectual musculature to open a console and type a li

Re: tail for a list of files

2018-03-04 Thread R. G. Newbury
From: Joe Zeff On 03/04/2018 11:15 AM, R. G. Newbury wrote: find .  -name "*.pdf" | tail -n 2 does not 'find' the files in canonical order: it outputs 124.pdf and 126.pdf What does it print if you don't run it through tail? That exercise was left for those adventurous students with an inquir

Re: tail for a list of files

2018-03-04 Thread bruce
On Sun, Mar 4, 2018 at 2:31 PM, Joe Zeff wrote: > On 03/04/2018 11:15 AM, R. G. Newbury wrote: >> >> >> find . -name "*.pdf" | tail -n 2 >> >> does not 'find' the files in canonical order: it outputs 124.pdf and >> 126.pdf > > > What does it print if you don't run it through tail? > um.. hey guy

Re: tail for a list of files

2018-03-04 Thread Joe Zeff
On 03/04/2018 11:15 AM, R. G. Newbury wrote: find .  -name "*.pdf" | tail -n 2 does not 'find' the files in canonical order: it outputs 124.pdf and 126.pdf What does it print if you don't run it through tail? ___ users mailing list -- users@lists.f

Re: tail for a list of files

2018-03-04 Thread R. G. Newbury
From: Jonathan Ryshpan Subject: Re: tail for a list of files To: users@lists.fedoraproject.org Message-ID: <1520171408.2173.42.ca...@pacbell.net> Content-Type: multipart/alternative; boundary="=-PuQtDYwItgjfcLx2Crff" --=-PuQtDYwItgjfcLx2Crff Content-Type: text/plain; charset

Re: tail for a list of files

2018-03-04 Thread Jonathan Ryshpan
On Sat, 2018-03-03 at 11:15 -0500, bruce wrote: > Trying to figure out how to do a single line cmd (it should be > possible right??) to do a tail -5 for a list of files??? > > I thought I could combine find with exec/xargs and tail to generate > the list of files/tail data.. But couldn't figure ou

Re: tail for a list of files

2018-03-04 Thread Roger Heflin
find /foo -name "*dog.dat" -ls -exec tail -f {} \; -print will list only the filename -ls will list the long dir entry. {} is needed to deliver the filename you are working with. \; is needed to signal the end of the command. On Sat, Mar 3, 2018 at 12:45 PM, Clifford Snow wrote: > Correction - I

Re: tail for a list of files

2018-03-03 Thread Clifford Snow
Correction - I shouldn't have copy and pasted. drop the {} \; from the script find /foo -name "*dog.dat" -print0 | xargs -0 tail -n5 On Sat, Mar 3, 2018 at 10:44 AM, Clifford Snow wrote: > > > On Sat, Mar 3, 2018 at 8:40 AM, bruce wrote: > >> >> Thanks.. works .. but I forgot one thing... >>

Re: tail for a list of files

2018-03-03 Thread Clifford Snow
On Sat, Mar 3, 2018 at 8:40 AM, bruce wrote: > > Thanks.. works .. but I forgot one thing... > > Is there a way to list the "file" prior to the tail or would that > require a bash/shell script.. I could have sworn that I've seen how to > accomplish this a while ago... arggh! > > For that I think

Re: tail for a list of files

2018-03-03 Thread Samuel Sieb
On 03/03/2018 08:15 AM, bruce wrote: Trying to figure out how to do a single line cmd (it should be possible right??) to do a tail -5 for a list of files??? I thought I could combine find with exec/xargs and tail to generate the list of files/tail data.. But couldn't figure out the syntax.. tho

Re: tail for a list of files

2018-03-03 Thread bruce
On Sat, Mar 3, 2018 at 11:25 AM, Clifford Snow wrote: > find /foo -name "*dog.dat" -exec tail -5 {} \; > > should work. You could also add various find options like -type f to make > sure its a regular file and -mtime n to get recently modified files. > > On Sat, Mar 3, 2018 at 8:15 AM, bruce wro

Re: tail for a list of files

2018-03-03 Thread bruce
On Sat, Mar 3, 2018 at 11:31 AM, Joachim Backes wrote: > On 03/03/18 17:15, bruce wrote: > Hi Bruce, >> >> Hey.. >> >> Trying to figure out how to do a single line cmd (it should be >> possible right??) to do a tail -5 for a list of files??? >> >> I thought I could combine find with exec/xargs and

Re: tail for a list of files

2018-03-03 Thread Joachim Backes
On 03/03/18 17:15, bruce wrote: Hi Bruce, Hey.. Trying to figure out how to do a single line cmd (it should be possible right??) to do a tail -5 for a list of files??? I thought I could combine find with exec/xargs and tail to generate the list of files/tail data.. But couldn't figure out the s

Re: tail for a list of files

2018-03-03 Thread bruce
ah... exec instead of xargs... ok... is there a way with exec ??? thanks On Sat, Mar 3, 2018 at 11:25 AM, Clifford Snow wrote: > find /foo -name "*dog.dat" -exec tail -5 {} \; > > should work. You could also add various find options like -type f to make > sure its a regular file and -mtime n

Re: tail for a list of files

2018-03-03 Thread Clifford Snow
find /foo -name "*dog.dat" -exec tail -5 {} \; should work. You could also add various find options like -type f to make sure its a regular file and -mtime n to get recently modified files. On Sat, Mar 3, 2018 at 8:15 AM, bruce wrote: > Hey.. > > Trying to figure out how to do a single line cmd

tail for a list of files

2018-03-03 Thread bruce
Hey.. Trying to figure out how to do a single line cmd (it should be possible right??) to do a tail -5 for a list of files??? I thought I could combine find with exec/xargs and tail to generate the list of files/tail data.. But couldn't figure out the syntax.. thoughts?? find /foo -name "*dog.d