I'm trying to process the last line in a file each time its saved. This is what I have so far:
tail -F -n0 '/path/to/foo.txt' |
grep "." | while read line
do echo "$line"
done
If I drop the grep, I'll get the last line, the first time the script is run, but when the target file is saved to, the entire file will be output, rather then just the new last line (the desired behaviour).
I need grep to strip the returns, as this is most often the last character in these text files. Im finding the above with the output piped to grep, doesn't return anything.
Im a novice here, so any guidance is very much be appreciated.