Search code examples
greppipetail

tail -f pipe not only the single line


I would like to pipe log file with tail -f but only the last line. My command is

tail -f logfile.log | while read line; do /usr/bin/gammu --sendsms TEXT ****** -text "$line"; done

I saw that I can use grep --line-buffered but my new line can't have any char and with what I have tried it doesn't work.


Solution

  • The error shows the problem is other place, which you don't show to us. Below test code is fine for me.

    tail -1f logfile.log | while read line
    do 
       echo /usr/bin/gammu --sendsms TEXT ****** -text "$line"
    done