#!/bin/bash
# name:         satwho
# description:  Print a list of the satellite users.
# author:	G.R.Keech <rkeech@redhat.com>
# 		Jan Pazdziora
# date:		2006-01-31, 2011-01-11

BLOCK=0
echo "select login from web_contact;"| spacewalk-sql --select-mode - | grep -v "^$" |\
while read line
do
  if [ $BLOCK -eq 0 ]
  then
    # We are before the block so do not print anything.

    # First look for the horizontal separating line
    echo "$line" | grep "^-*$" &>/dev/null && BLOCK=1
  else
    # We are in the block, so print the line, so long as it is not the line with "rows selected"
    echo "$line" | egrep "rows?\)$|rows selected.$" &>/dev/null || echo $line
  fi
done

