Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi all,
I am trying to display the contents of a file, the file that i want to display the contents of is a different file every day.
When i use the ls -lrt command the file that i wish to display using pg, is always the last one so if i use tail -1 i can get this file with all its details.
I then want to pg this file to display its contents from within a script.
Note if i do an ls rather than ls -lrt the file i want is no longer the last one and thus the tail -1 command won't find the correct file.
What i need to do is the ls -lrt | tail -1 to find the correct file, then strim this so that i am left with just the filename and then pg this file, all from within a script. I can't figure this bit out!
The .trc files that i am searching for are created everyday so i am always looking for the most recent one.
Hope someone can help, Thanks.

Thanks, although now i have the name of the correct file i still need to display its contents so that when i run my script the contents of the files will be displayed.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |