Here is an example program along with some<br>input to quickly test it with.<br><br>I hope this helps you.<br><br>flogrr<br><A HREF="mailto:flogr@yahoo.com">flogr@yahoo.com</A><br><br>#!/usr/bin/sh<br>#<br># Name: testit<br>#<br># Purpose: 1. Delete a line from file given a pattern.<br>#<br># 2. Capture system date and time and pass<br># to two variables ( "date" and "time" ).<br>#<br># 3. Pass in a variable to be used for<br># pattern matching within the program<br>#<br># Usage: testit infile outfile pattern parameter<br>#<br>#<br># Shell variables containing data to be<br># passed into program from command line.<br>#<br>#<br><br>pattern=$3<br>dnt=`date '+%Y-%m-%d %T'`<br>parameter=$4<br><br>nawk '<br><br>{<br> if ( $0 ~ /'"$pattern"'/ ) { # does not output matched line;<br> next # reads next line, effectively<br> } # deleting the matched line<br><br> if ((!date)&&(!time)) {<br> date = substr("'"$dnt"'",1,10) # expand shell variable in nawk<br> time = substr("'"$dnt"'",12) # take substrings as needed<br><br> print "The date today is: " date "\n"<br> print "The time is now: " time "\n"<br> }<br><br>if ($0 ~ /'"$parameter"'/) {print $1 ; next }<br><br>print<br><br>}' $1 > $2<br><br>clear<br><br>more $2<br><br># Sample input file<br><br># bla bla bla bla bla bla bla<br># bla bla bla bla bla bla bla<br># bleep bla bla bla bla bla bla # question (1)<br># bla bla bla bla bla bla bla<br># bla bla bla bla bla bla bla<br># 21993 30134 49539 56213<br># 21993 30135 49540 56214<br># 30003 30136 49541 56215 # question (3)<br># 21993 30137 49542 56216<br># 21993 30138 49543 56217<br><br>