3

I've a running java project that prints it's output to a file named in according to the current time:
03:45 ==> 03.out
13:24 ==> 13.out
etc... Now I want to watch tail of the file currently having the project's output. Please note that I know the current file name in a specific meta file. If I execute the following: watch $(tail specific_meta_file) It's not working since it watch only the file at the current time not in another time

  • You want to watch the file at a time in the future? – Raman Sailopal Dec 5 '17 at 10:02
2

Tail can watch multiple files at once:

$ tail -f file1 file2 file3 file4 file5 file6 ...
  • I 'm searching a more suitable solution. I want to watch just the current file (the file is being written by the project currently) not all the files at the same time! – Mohsen Abasi Dec 5 '17 at 9:48
  • 2
    @MohsenAbasi I understood file are writen one at a time, so once output to 03.out is exhausted, you would see only "active" file. – Archemar Dec 5 '17 at 10:20
  • @Archemar I don't want see the active file. I just want to tail the active file: sometimes 01.out, sometimes 02.out, etc. If I tail all the files together in according to your answer, the outputs will be mixed. I just want to see the output from 1 file (active file) not all the files together!!!! – Mohsen Abasi Dec 9 '17 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.