Wow, I could not think of a good way to title this question. Basically I have a file called "attendance" with data like this:
11/06/2014 101.11.001.01 FirstName LastName
11/06/2014 101.11.001.01 FirstName LastName
11/06/2014 101.11.001.01 FirstName LastName
11/06/2014 101.11.001.01 FirstName LastName
Basically it's the date, IP address, First name, and Last name. The above is how it is formatted in the "attendance" file. I have created an html page with text boxes and a submit button where a user can either: A.) Enter a FN/LN and receive a list of dates that person logged in, OR B.) Type in a date and receive a list of users who logged in on that date.
I'm getting the results I want, but the result of the grep displayed in the browser is all on one line, like this:
11/06/2014 101.11.001.01 FirstName LastName 11/06/2014 101.11.001.01 FirstName LastName 11/06/2014 101.11.001.01 FirstName LastName 11/06/2014 101.11.001.01 FirstName LastName
Obviously this is sub-optimal. I need the grep results to appear on separate lines. Below is my .cgi file. "getvars" is just a script the professor made for converting variable types. Also, I'm cutting corners by only grepping last name, because nobody has the same last name:
#!/bin/bash
. ~/bin/getvars
if [ ! -z "$LN" ]; then
cat attendance | grep $LN
elif [ ! -z "$DATE" ]; then
cat attendance | grep $DATE
else echo No Records Found
fi
I've tried to be as concise as possible and I apologize is anything doesn't make sense. My only question is: How do I get the grep results on separate lines?