outputting data in table from grep results


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting outputting data in table from grep results
# 1  
Old 05-12-2008
outputting data in table from grep results

Hi all. I'm a real unix newbie and looking for some help on a shell scripting problem. I'm going the longest ways around everything but I'm getting there.
My next problem however has me stumped.
I have set up a program that takes inputs from a user for a particular month and year (and stores them in variables) then searches a list of hits files for these values.
The hits files all contain information on webpage visits, so the hits for adventure.html are stored in adventure.hits.
These hit files are made up of several columns:

103.45.155.82 Tue Nov 15 03:23:42 GMT 2006

My script so far will search all of those hits files for the specified month and year, so Nov 2006 for example, then outputs the results to a temporary file.
This temporary file records all the columns for the records matching the search criteria as well as listing the filename in the first column. like this:

adventure.hits:103.45.155.82 Tue Nov 15 03:23:42 GMT 2006

I need to now output a table to the terminal that shows data under headings like this:

Page Name - Hits - Unique Hits
adventure.hits 58 18
sports.hits 107 12

Any ideas how to go about this?
Thanks!
# 2  
Old 05-12-2008
If you are not doing this primarily for the learning, you should be aware that there is a metric godzillion web log analyzer packages out there, some of them very sophisticated. The first lesson would be don't reinvent what you can download.
# 3  
Old 05-12-2008
Sadly it is for academic purposes. So downloading anything is a no sadly. Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Outputting data from log file to report

I have a log file that looks like this. the lines are grouped. 2 lines per entry. M: 2019-01-25 13:02:31.698 P25, received network transmission from KI4EKI to TG 10282 M: 2019-01-25 13:02:35.694 P25, network end of transmission, 4.3 seconds, 1% packet loss M: 2019-01-25 13:02:38.893 P25,... (7 Replies)
Discussion started by: ae4ml
7 Replies

2. Shell Programming and Scripting

Postgre Query results as Email HTML table

Hello, I'm trying to send email from Greenplum query results as HTML table with status Red/Green Select Server, Last_Date from Table; Results Server, Last_Date Prod, 2018-04-09 Final email Output in HTML format Server Status LastDate Prod GREEN(BOX) 2018-04-09 (if... (2 Replies)
Discussion started by: krux_rap
2 Replies

3. Shell Programming and Scripting

Outputting Results to Indexed List

I'm looking for some suggestions on a command line utility I am making. I would like to use 'find' to locate some files and index the results so the user can choose the correct results from the list and push that input into an open command. A simple example below: ... (2 Replies)
Discussion started by: sudo
2 Replies

4. Shell Programming and Scripting

[Solved] Shell script output in HTML or with table like results and mail

Hello, Currently i have a script which will disply the results in plain text format. I want to format the result in more readable format like Making bold headings and format with colors etc. Something like html and send that content as email. Please help me how i can do that. I am using... (10 Replies)
Discussion started by: joy lobo
10 Replies

5. Shell Programming and Scripting

Store results in table

Hello everyone, I have a shell script, which connects to the database and runs .sql file. after executing of .sql file, i need to store the results in error table. How can i achieve this one? could you please give your suggestions. here is my code. #!/bin/sh #set -vx SCHEMA_NAME=$1... (1 Reply)
Discussion started by: Rami Reddy
1 Replies

6. Shell Programming and Scripting

shell script output in HTML or with table like results

Hello, Currently i have a ksh script which will disply the results in plain text format. I want to format the result in more readable format like Making bold headings and format with colors etc. Something like html or excel format and send that content as email. Please help me how i can do... (2 Replies)
Discussion started by: kotasateesh
2 Replies

7. Shell Programming and Scripting

Outputting discarded GREP lines to a file

I had a question about grep. If I grep for something in a file, the output shows me all the lines in which that 'something' is contained in. Is there a way to also output all the lines in which that 'something' wasnt contained in. Say I have a file with a bunch of names and I do: grep scott... (2 Replies)
Discussion started by: ndedhia1
2 Replies

8. Shell Programming and Scripting

Outputting data from multiple lines

Hi guys, looking for a bit of advise, and as I am a complete novice, please excuse the daft questions!! I have a list of events and of which entry looks like this; # # Event 1 # NAME = Event 1 # 12345 : 123 : 1 : 1 : L,1,N : 1,0 : Event # # Event 2 # NAME = Event 2 # 12346... (8 Replies)
Discussion started by: JayC89
8 Replies

9. Shell Programming and Scripting

Outputting to table

I have information in a file called HITS. This file has been populated by the user entering search criteria. the HITS file contains information: filname.hits: 123.33.345.66 Fri Nov 26 11.45.56.43 GMT 2006 at the moment i am just displayin the information using cat HITS. ... (3 Replies)
Discussion started by: amatuer_lee_3
3 Replies

10. Shell Programming and Scripting

grep: outputting search strings

Newbie question -- any help very much appreciated: I want to be able to get grep (or whatever else would work) to return not only matching lines, but also the original input string: An example may help: Suppose I have two files data1.txt and data2.txt: data1.txt Hello my name is foo. What... (3 Replies)
Discussion started by: tapmas
3 Replies
Login or Register to Ask a Question