I'm attempting to use part of a one-liner found here: Script to monitor folder for new files?
When I try the following procedure I get no output whatsoever and I cannot figure out why.
In terminal 1:
inotifywait -m ~/somefolder | awk '{ print $3; fflush() }'
Then in terminal 2:
touch ~/somefolder/newfile
When not piping to awk, inotifywait lists all the expected events to stdout and has no problem redirecting to a file either. Awk also appears to work correctly independent of inotifywait on text piped to it structured like the output of inotifywait. Using the two together just doesn't work for me.
EDIT:
awk was an alias for mawk on my machine which didn't work. gawk, however, came through and worked as expected.
gawk
instead ofmawk
worked, consider making your edit into an answer and accepting the answer. – George M Jan 26 '13 at 18:07