Skip to content

Instantly share code, notes, and snippets.

@jabley
Created March 6, 2012 09:35
Show Gist options
  • Save jabley/1985314 to your computer and use it in GitHub Desktop.
Save jabley/1985314 to your computer and use it in GitHub Desktop.
grep pipe filters broken on OSX Lion
#!/bin/sh
# Script to generate logging output
while true; do
echo $(date +%Y-%m-%dT%H-%M-%S) "WARN Here is a log message about events"
sleep 1;
done
# Typically, this is since I'm tailing a log file and filtering out noise to get the lines that I'm interested in
$ ./generate_log > app.log&
$ tail -f app.log | grep events
2012-03-06T09-27-45 WARN Here is a log message about events
2012-03-06T09-27-46 WARN Here is a log message about events
2012-03-06T09-27-47 WARN Here is a log message about events
2012-03-06T09-27-48 WARN Here is a log message about events
$ tail -f app.log | grep WARN
2012-03-06T09-27-07 WARN Here is a log message about events
2012-03-06T09-27-08 WARN Here is a log message about events
2012-03-06T09-27-09 WARN Here is a log message about events
$ tail -f app.log | grep WARN | grep events
# Nothing!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment