A
A
Anatoly2020-02-11 01:24:00
Debian
Anatoly, 2020-02-11 01:24:00

How to display and update part of the log (watch tail awk)?

Where is the error in the line:

watch -n1 -t tail /var/access.log | awk '{print $1}'


If I write watch -n1 -t tail /var/access.log, everything works.
If I write tail /var/access.log | awk '{print $1}', too, everything works,
but if I write as in the first line, it does not work.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
vreitech, 2020-02-11
@Tolly

watch -tn1 'tail /var/access.log | awk '\''{print $1}'\'''

V
Vadim Priluzkiy, 2020-02-11
@Oxyd

You are doing something fundamentally wrong in this particular case. In the case of tail, it's done like this: The answer above, for the watch case, is correct, but its readability leaves much to be desired. Better this way:
tail -f /var/access.log | awk '{print $1}'

watch -n1 -t "tail /var/access.log | awk '{print $1}'"

R
Radjah, 2020-02-12
@Radjah

What should be the end result of this action?
I can feel the crutches being propped up by bicycles.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question