#!/bin/sh # StripLine.sh # 2007-01-12 # Chieh Cheng # http://www.CynosureX.com/ # GNU General Public LIcense (GPL) Version 2, June 1991 scriptName=`echo $0 | sed s/\\\\/.*\\\\///g` if [ $# -lt 2 ] then echo " Usage: $scriptName \"pattern\" \"file 1\" [ . . . \"file n\" ]" exit fi findStr="$1" shift for file do if [ -f "${file}" ] then result=`grep -c "${findStr}" "${file}"` if [ $result -gt 0 ] then printf "${file} has ${result} lines . . ." tmpFile=`GetTempPathName.ksh "${scriptName}"` grep -v "${findStr}" "${file}" > "${tmpFile}" cp "${tmpFile}" "${file}" rm "${tmpFile}" echo " stripped." fi else echo "${file} is not a file." fi done