Skip to content

Instantly share code, notes, and snippets.

@dbyler
Last active December 12, 2015 12:38
Show Gist options
  • Save dbyler/4773203 to your computer and use it in GitHub Desktop.
Save dbyler/4773203 to your computer and use it in GitHub Desktop.
Executes cat, then tail -f
cattail() {
if [ ! $1 ]; then
echo "usage: cattail 'string' file"
else
grep "$1" $2
tail -f -n 0 $2 |grep "$1"
fi
}
alias ct=cattail
@dbyler
Copy link
Author

dbyler commented Feb 12, 2013

For those wondering, the name came out of using cat $FILE |grep $STRING instead of grep "$STRING" $FILE because it's easier to just arrow up and change cat to tail -f than restructure the command.

(Not that I needed to explain myself; there's more than one way to skin a cat...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment