How to Implement Grep into CGI script Please?
- by Joey jie
Hi all!
I am having difficulty figuring out how to implement grep into my CGI script. Basically I will receive a value of eg. 1500 from a HTML page. The CGI script then runs and compares 1500 to a text file. When it finds 1500 it prints the entire line and displays it on the webpage. I would like some tips and pointers on how to do this please. I understand that this involves grep but I don't really know how to put it in.
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char *data;
long m,n;
printf("%s%c%c\n",
"Content-Type:text/html;charset=iso-8859-1",13,10);
printf("<TITLE>Webpage of Results</TITLE>\n");
printf("<H1>Temperatures</H1>\n");
data = getenv("QUERY_STRING");
The HTML passes the variable time=1500. I understand (correct me if I am wrong) that QUERY_STRING will contain 1500?