Friday, August 10, 2007

Linux "grep -A1 -B1" in HP-UX

cat syslog.*.gz | gzip -d - | sed -n -e '/regexp/{=;x;1!p;g;$!N;p;D;}' -e h

The cat syslog.*.gz | gzip -d - can also be replaced by using this command: gzcat < syslog.*.gz

No comments: