#! 

if test $# == 0
then
	clear
	echo "
	scan/grep but return JUST the match, not the whole line

	example,     hits t.*f /GPL
	"
exit
fi




EXPAT=$1		# pass script's $1 to awk via ENVIRON
export EXPAT

awk  -- '     
BEGIN{ PATTERN=ENVIRON["EXPAT"] }

{ SOME=$0
while (SOME)
	{ RLENGTH= -1
	match(SOME, PATTERN)
	if ( RSTART)
		{ 
		printf (substr(SOME, RSTART, RLENGTH)" " )
		MORE = substr(SOME, RSTART+RLENGTH, length(SOME)-RSTART )
		SOME = MORE
		}
	else 	{
		print ""
		next 
		}	
	}
} 

' $2 

