I want to process all changed logfiles from apache and made a simple oneliner:
inotifywait --format="%w%f" -rm /var/log/apache2/ | gawk '{ print }'
This is exactly my start. But if I pipe that output further, I get no output:
inotifywait --format="%w%f" -rm /var/log/apache2/ | gawk '{ print }' | wc -l
Anyway, if I use 'ls', 'tail' (what I really want), there is never output (in another console, running the first statement, I know, there are changes). I tried with adding stdbuf, fflush(), nothing works. I dont understand the problem! I want to keep this onliner into a script, which I can use as a string point. Otherwise, I could (but dont wish to) use xargs. Any help or tips would be fine!
awk
command here does nothing at all.wc
andtail
don't print anything until all data is read.ls
doesn't read stdin at all. – jordanm Jul 19 '18 at 01:35awk
withfflush()
-- As:gawk -e '{ prnt ; fflush(); }'
. It must have the empty parentheses"()". Alternatively try... | mawk
as:mawk -Winteractive -e '{ print $0; }' | ...
– will Sep 12 '19 at 06:18