#!/bin/csh -f # Script to grep the acctail_https. Useful as: # ssh remote_host acctail_https_grep_404 # which sends only the matched lines across the wire, as opposed to: # ssh remote_host acctail_https | grep " 404 " # which sends all lines across the wire and filters locally # Also, preserves the spaces around the 404 which are lost by: # ssh remote_host acctail_https_grep " 404 " # Without the --line-buffered option, grep buffers its output. # So when used in a pipe, it may never actually emit anything out of # the end of the pipe until the data stream ends. That's fine for # batch processes, and it's more efficient. But, it's a problem # when feeding in live data like tail -F and expecting to see output # immediately. Especially when used with other pipe elements that # buffer their output (grep, sed, others?). Until all of the buffers # of the entire pipe fill up, you get no output. And if you kill the # process with Ctrl-C (since tail -F never ends), any buffered output # is lost. set grep = "grep --line-buffered" acctail_https | $grep --color " 404 "