Tables and borders


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Tables and borders
# 1  
Old 05-15-2008
Tables and borders

when i do this:

cat HITS

i get the following displayed:

sport.hits:87.114.172.31 Thu Sep 28 22:45:12 GMT 2006

how do i put this information into a bordered table?

so it will output like this:

...........File / IP..................Day.....Month.....Date............Time..............Year
sport.hits:87.114.172.31......Thu......Sep....... 28........22:45:12 GMT...... 2006
# 2  
Old 05-15-2008
Don't know what you really want, but quite likely it would suit your needs to import that file as csv file into some spreadsheet like OpenOffice Calc and use space as separator instead of comma.
# 3  
Old 05-15-2008
basically what i want is for my output to be displayed in a table that has a border.

i am running a script that searches ip adresses from various files.
the files are displayed (using cat HITS) once they have been searched.
they are displayed from a file called HITS

they are displayed in a list like this when they are output:

adventure.hits:223.79.87.212 Tue Sep 05 02:19:02 GMT 2006

i want to be able to have this output placed in a table format with borders and headings for each column:

File / IP
Day
Month
Date
Time
Year

does this explain it a bit better?
# 4  
Old 05-15-2008
If you know html, it's not too hard to wrap the data with row and cell tags, and also insert the remainder of the page layout tags, so the resulting file will open with any browser, and look like a half-way decent table with lines.

A few years ago, I did something similar where I generated html code from a program I wrote in a freeware version of Basic of all things.
# 5  
Old 05-15-2008
it wont be running on the internet. but i do know html.

would it still work?
# 6  
Old 05-15-2008
What do you want to do with that table?

Use as input for some dumb script requiring constant length fields -> you need a real script solution
Simply have good looking logs -> go for csv or html idea

html idea: no, you don't need to be connected to the internet therefore, you just need a browser to view that html file. Even if you are on a text terminal (and do not want to copy that file to some X-machine) you can use lynx or w3m to view that html file.
# 7  
Old 05-15-2008
ok basically this is my script:

Quote:
echo "Lee Mather, 359018, UPROC PART B"

echo " "

echo "--------------------------------"

echo " "

answer=[Yy]
while [ $answer ]

do

echo temp >tempfile

echo "--------------------------------"
echo "** Welcome to the HITS search **"
echo "--------------------------------"
echo " "
echo "This program will allow you to search for hits across all of your hit files."
echo "It will limit the results using search criteria."




echo " "
echo "Enter Date of the Month
(1-31): "

read DATE

grep $4 "$DATE" *.hits >tempfile



echo " "
echo "Enter the month in which you wish to search
(Please enter months in the form of Jan, Feb, Mar, etc...): "

read MONTH

grep $5 "$MONTH" tempfile > tempmonth



echo " "
echo "Enter Year (Please enter year between 2005 and 2007): "

read YEAR

grep $8 "$YEAR" tempmonth > HITS



sleep 2

echo " "
echo "The number of results found is: "

wc -l HITS

echo " "
echo "Number of unique I.P.'s: "

awk '{print$2}' HITS | uniq | wc -l



echo " "
echo "Here are your results: "

sleep 2

cat HITS

sleep 4


rm -r tempfile HITS tempmonth


echo " "
echo "Would you like to run the HITS search again?: "
echo "Enter Y or y to restart and press Enter"

read answer
case $answer in
Y|y) echo " "
echo "Please wait while HITS refreshes"
echo " "
sleep 2 ;;
*) echo " "
echo "Goodbye. Thank you for using the HITS search."
sleep 3
break;;
esac
done
I want to output "cat HITS" into a table just to show the user their results from the search. i just wanted to make the display clearer by adding column and row borders and column headings.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Web Development

Getting Rid of Annoying Bootstrap Table Borders and Wayward Table Lines

Bootstrap is great; but we have had some issues with Bootstrapped <tables> (and legacy <fieldset> elements) showing annoying, wayward lines. I solved that problem today with this simple jQuery in the footer: <script> $(function(){ $('tr, td, fieldset,... (0 Replies)
Discussion started by: Neo
0 Replies

2. Shell Programming and Scripting

Help needed in sending file content with colors and borders

HI i am running a shell script in cron and storing the output of that script in a file say test.then i am copying the content of test to test1 and i will send the output of test to some email ids using mutt. Next time when the script executes i am comparing the contents of test and test1 and... (3 Replies)
Discussion started by: venkitesh
3 Replies

3. Shell Programming and Scripting

Compare with 2 tables

I have 3 file inputs, file1 20160302|5485368299953|96|510101223440252|USA|5485368299953|6|800|2300|0 20160530|5481379883742|7|510101242850814|USA|5481379883742|5|540|2181|1500 20160513|5481279653404|24|510100412142433|INDIA|5481279653404|3|380|1900|0... (1 Reply)
Discussion started by: radius
1 Replies

4. Shell Programming and Scripting

Comparing two tables

I have defined a set of global variables at the beginning of my script as below: #ideal values export ITEM1=SUCCESS export ITEM2=FAILURE export ITEM3=UNAVAILABLE export ITEM5=FAILURE export ITEM6=SUCCESS now I have a shell script function which returns a value in below format. ITEM1... (1 Reply)
Discussion started by: ctrld
1 Replies

5. Programming

C++ Dictionaries and tables

I was looking at this code from a programming book: #include <time.h> #include <iostream> #include <string> #include <deque> #include <map> #include <vector> #include <cstdlib> using namespace std; const int NPREF = 2; const char NONWORD = "\n"; // cannot appear as real line: we... (1 Reply)
Discussion started by: totoro125
1 Replies

6. Programming

How to render solid borders in NCURSES windows

Hello All Gr8 Linux Developers Out There, Background ========= I have created a ncurses application that is suppose to run only on the Linux's virtual console. This application will heavily utilize the ncurses windows to show window-based UI to the user. I am using CentOS5.x. The terminal for... (7 Replies)
Discussion started by: ku@ntum
7 Replies

7. Shell Programming and Scripting

tables in scripts

Hi , I have two tables with same length t1 and t2, I want to cretae a new third table where i put the difference between the elements of t2 and t1, t3= t1 - t2 t3= t1 - t2 I am new to scripts, any help please? thanks (7 Replies)
Discussion started by: Celine19
7 Replies

8. Shell Programming and Scripting

Converting tables of row data into columns of tables

I am trying to transpose tables listed in the format into format. Any help would be greatly appreciated. Input: test_data_1 1 2 90% 4 3 91% 5 4 90% 6 5 90% 9 6 90% test_data_2 3 5 92% 5 4 92% 7 3 93% 9 2 92% 1 1 92% ... Output:... (7 Replies)
Discussion started by: justthisguy
7 Replies

9. UNIX for Dummies Questions & Answers

Routing tables

Hey guys, I needed to add a route to my routing table and I got it to work but on reboot it gets removed. Anyone know what file I can add this route to so it stays on the machine after a reboot? (9 Replies)
Discussion started by: kingdbag
9 Replies
Login or Register to Ask a Question