home *** CD-ROM | disk | FTP | other *** search
- From: budd@bu-it.bu.edu (Phil Budne)
- Newsgroups: comp.unix.wizards,alt.sources
- Subject: A few of my favorite pipes...
- Message-ID: <59915@bu.edu.bu.edu>
- Date: 3 Jul 90 21:25:01 GMT
-
- A few weeks ago favorite pipes were a topic on unix-wizards. Here are
- a few of my favorite pipes ( to tune of "my favoite things" ) I
- collected in the process of cleaning up in preparation for leaving my
- job;
-
- For seeing if anything of mine is stuck in the mqueue (I call it "mq");
-
- #!/bin/sh
- # display my items in the mail queue
- if [ $# -gt 0 ]; then
- who=$1
- else
- who=`whoami`
- fi
- echo Pending messages on `hostname` from user $who
- #
- mailq | \
- awk " BEGIN { pr = items = found = 0; } \
- /^AA/ { if( \$0 ~ /$who/ || \$0 ~ /$who\@\.\*/ ) { \
- pr = 1; found++; } \
- else { pr = 0; } items++; } \
- { if( pr ) print } \
- END { if( found > 0 ) fm = \"(\" found \" displayed)\";
- print items \" total \" fm } "
-
- A summation of rwho output (I call it "uz");
- #!/bin/sh
- if tty -s <&1;
- then
- rwho $* | sed 's/[ ].*//' | uniq | fmt
- else
- rwho $* | sed 's/[ ].*//' | uniq
- fi
-
- A count of users as displayed by "uz" (I call it "uc");
- rwho $* | sed 's/[ ].*//' | uniq | wc -l
-
- For seeing what batched news is queued for a site (I call it "gq")
-
- #/bin/sh
- # NOTE! our /usr/spool/news is in /news
- SPOOLDIR=/news
- if [ "$1" -a -f $SPOOLDIR/batch/$1 ]; then
- sed -e 's@/[0-9].*$@@' \
- -e "s@^$SPOOLDIR/@@" \
- -e 's@/@.@g' < /usr/spool/news/batch/$1 |\
- sort | uniq -c | sort -rn
- fi
-
- Show most frequently executed commands (I call it "lastfreq");
-
- lastcomm | sed 's/ .*//' | sort | uniq -c | sort -rn
-