К основному контенту

REGEXP MATCH BASH

Find blocked messages 

grep -E "Blocked SPAM" /var/log/maillog | grep -v grep | awk 'match($0,/<[0-9a-z.]{1,}@[][0-9a-z.]{1,}> -> <[0-9a-z.]{1,}@[][0-9a-z.]{1,}>/) {print substr($0,RSTART,RLENGTH)}'

grep "SIP/gsm" checker.log.2022-09-* | awk 'match($0, /: load [0-9]*/) {print substr($0,RSTART,RLENGTH)}' | awk 'match($0, /[0-9]*$/) {print substr($0,RSTART,RLENGTH)}' | awk 'n < $0 {n=$0}END{print n}'

Комментарии

Популярные сообщения из этого блога

Repeat Linux command every x seconds

watch -n 5 "ps -ef | grep COPY" watch -n 10 "psql -U postgres -c \"select clock_timestamp() - query_start as duration, substr(query,1,50) from pg_stat_activity where pid <> pg_backend_pid() and state='active' order by 1 desc\"" for i in {1..10}; do ps -ef | grep COPY; date ; sleep 5; done while true; do ps -ef | grep COPY ; date ; sleep 5; done