2

I have 3 files and I want watch the changes of these files with 'watch' command. But these 3 files have a lot of row and I just want see the last 3 rows with 'tail'. There is no problem at here. I can use this command for this:

watch 'tail -3 file1; tail-3 file2; tail -3 file3'

This command give me an output like this:

Every 2.0s: tail -3 file1; tail -3 file2; tail -3 file3
file1 row9
file1 row10
file1 row11
file2 row9
file2 row10
file2 row11
file3 row9
file3 row10
file3 row11

I want to separate these rows with any separator and see the result as like this:

Every 2.0s: tail -3 file1; tail -3 file2; tail -3 file3
file1 row9
file1 row10
file1 row11
-----
file2 row9
file2 row10
file2 row11
-----
file3 row9
file3 row10
file3 row11

The separator doesn't matter. I just want to see the results as separated.

1
  • You might have better luck here
    – Robbie Dee
    Commented Jul 20, 2017 at 8:25

1 Answer 1

2

I'm not overly familiar with the watch command but it seems to itself consume a command line so couldn't you just inline some echo commands like this:

watch 'tail -3 file1; echo ---------- ; tail-3 file2 ; echo ---------- ; tail -3 file3'
1
  • I can't give positive vote for now because of my reputation point. But i'll remember your help when i got 15. Thanks. Commented Jul 20, 2017 at 10:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .