#!/bin/sh #----------------------------------------------------------------------- # $ACS$ # # Name: nocomment # Description: strip leading comments out of a file or stdin # Keywords: script # $Id$ # # Author: Royce Williams # Creation Date: 2008-08-07 # Version: os/unixlike 1.0 #----------------------------------------------------------------------- MYSHORTNAME=`basename $0` USAGE() { echo "" echo "$MYSHORTNAME: strip leading comments out of a file or stdin" echo "" echo "Usage:" echo " $MYSHORTNAME [filename]" echo " cat [filename] | $MYSHORTNAME" echo "" } # If we are not given a filename, assume stdin. if [ -z "$1" ]; then egrep -v '^$|^#' exit $? fi # If we are given a value, assume it's a file. if [ -f "$1" ]; then egrep -v '^$|^#|^;' $1 exit $? else USAGE fi #-----------------------------------------------------------------------