Skip to content

Instantly share code, notes, and snippets.

@thiagocaiubi
Created October 30, 2015 18:24
Show Gist options
  • Save thiagocaiubi/41459c08c9ccc89f1af7 to your computer and use it in GitHub Desktop.
Save thiagocaiubi/41459c08c9ccc89f1af7 to your computer and use it in GitHub Desktop.
tail grep and do what you want
tail -fn0 logfile | \
while read line ; do
echo "$line" | grep "pattern"
if [ $? = 0 ]
then
... do something ...
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment