Sponsored Content
Top Forums Shell Programming and Scripting help with a bash script to create a html table Post 302401506 by dr.house on Saturday 6th of March 2010 02:01:39 PM
Old 03-06-2010
A point to start from (?):

Code:
#! /bin/bash

ROWS=3
COLS=3

LIST=(
  [11]="Apples"  [12]="Oranges" [13]="Bananas"
  [21]="Pears"   [22]="Kiwis"   [23]="Plums"
  [31]="Peaches" [32]="Grapes"  [33]="Melons"
)

echo "<table>"
for ((RI=1; RI<=$ROWS; RI++))
do
  echo -e "\t<tr>"
  for ((CI=1; CI<=$COLS; CI++))
  do
    echo -e "\t\t<td>${LIST[$RI$CI]}</td>"
  done
  echo -e "\t</tr>"
done
echo "</table>"

exit 0

Code:
[house@leonov] bash test.bash
<table>
        <tr>
                <td>Apples</td>
                <td>Oranges</td>
                <td>Bananas</td>
        </tr>
        <tr>
                <td>Pears</td>
                <td>Kiwis</td>
                <td>Plums</td>
        </tr>
        <tr>
                <td>Peaches</td>
                <td>Grapes</td>
                <td>Melons</td>
        </tr>
</table>

(Reference: Arrays)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[ORACLE] CREATE TABLE in bash

Hey, I want to create a table in bash, my db server is oracle. You can find my script below: I am very confused. I tried to run this script many times without any luck. Please help! (6 Replies)
Discussion started by: radek
6 Replies

2. 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

3. Shell Programming and Scripting

Create DB table through shell script

Hi, Can anyone tell me that, How to create table in Oracle database through shell script(ksh). Table contains 3 fields, 1] Emp ID, String, primary key 2] Name, String 3] B Date, date. Thanks in advance. (6 Replies)
Discussion started by: Poonamol
6 Replies

4. Shell Programming and Scripting

How can we create a string table in bash shell ?

Hello, How can we write the pseudo code below using Bash shell scripting? table = ; i=0; do{ grep table h.txt; }while(i<3); or table = ; i=0; for(i=0;i<3;i++) grep table h.txt; (4 Replies)
Discussion started by: dbgork
4 Replies

5. UNIX for Dummies Questions & Answers

Bash script to insert data into an html table

hi, I need to create a bash shell script which picks up data from a text file and in the output file puts it into an html made table. I have to use sed and awk utilties to do this the input text file will contain data in the format: job name para1 para2 para3 para4 para4 1 ... (1 Reply)
Discussion started by: intern123
1 Replies

6. Shell Programming and Scripting

Bash shell script that inserts a text data file into an HTML table

hi , i need to create a bash shell script that insert a text data file into an html made table, this table output has to mailed.I am new to shell scripting and have a very minimum idea of shell scripting. please help. (9 Replies)
Discussion started by: intern123
9 Replies

7. Shell Programming and Scripting

Convert shell script output txt file to html table

Hi, I have script which generates the output as below: Jobname Date Time Status abc 12/9/11 17:00 Completed xyz 13/9/11 21:00 Running I have the output as a text file. I need to convert it into a HTML Table and sent it thru email ... (6 Replies)
Discussion started by: a12ka4
6 Replies

8. Shell Programming and Scripting

Create Script from table

I have a table ABC with 4 columns and below data Col1,Col2,Col3,Col4 prod,10,12,joba prod,10,11,jobb qa,10,12,jobc I want to create an output file like this Server:prod StartTime:10 EndTime:12 JobName:joba Server:prod StartTime:10 EndTime:11 JobName:jobb (3 Replies)
Discussion started by: traininfa
3 Replies

9. 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

10. Shell Programming and Scripting

Convert shell script output txt file to html table

My concnern related to the post -Convert shell script output txt file to html table, in this how to print the heading as color. awk 'BEGIN{print "<table>"} {print "<tr>";for(i=1;i<=NF;i++)print "<td>" $i"</td>";print "</tr>"} END{print "</table>"}' <filename> (8 Replies)
Discussion started by: sarajobmai
8 Replies
ZENITY(1)						      General Commands Manual							 ZENITY(1)

NAME
zenity - display GTK+ dialogs SYNOPSIS
zenity [options] DESCRIPTION
zenity is a program that will display GTK+ dialogs, and return (either in the return code, or on standard output) the users input. This allows you to present information, and ask for information from the user, from all manner of shell scripts. For example, zenity --question will return either 0 or 1, depending on whether the user pressed OK or Cancel. zenity --entry will output on standard output what the user typed into the text entry field. Comprehensive documentation is available in the GNOME Help Browser, under GNOME/Utilities. OPTIONS
This program follows the usual GNU command line syntax, with long options starting with two dashes (`-'). Dialog options --calendar Display calendar dialog --entry Display text entry dialog --error Display error dialog --file-selection Display file selection dialog --info Display info dialog --list Display list dialog --notification Display notification icon --progress Display progress indication dialog --question Display question dialog --text-info Display text information dialog --warning Display warning dialog --scale Display scale dialog General options --title=TITLE Set the dialog title --window-icon=ICONPATH Set the window icon --width=WIDTH Set the dialog width --height=HEIGHT Set the dialog height --timeout=TIMEOUT Set the dialog timeout Calendar options --text=STRING Set the dialog text --day=INT Set the calendar day --month=INT Set the calendar month --year=INT Set the calendar year --date-format=PATTERN Set the format for the returned date Text entry options --text=STRING Set the dialog text --entry-text=STRING Set the entry text --hide-text Hide the entry text Error options --text=STRING Set the dialog text --no-wrap Do not enable text wrapping File selection options --filename=FILENAME Set the filename --multiple Allow selection of multiple filenames in file selection dialog --directory Activate directory-only selection --save Activate save mode --separator=SEPARATOR Specify separator character when returning multiple filenames --confirm-overwrite Confirm file selection if filename already exists Info options --text=STRING Set the dialog text --no-wrap Do not enable text wrapping List options --text=STRING Set the dialog text --column=STRING Set the column header --checklist Use check boxes for first column --radiolist Use radio buttons for first column --separator=STRING Set output separator character --multiple Allow multiple rows to be selected --editable Allow changes to text --print-column=NUMBER Specify what column to print to standard output. The default is to return the first column. 'ALL' may be used to print all columns. --hide-column=NUMBER Hide a specific column Notification options --text=STRING Set the notification text --listen Listen for commands on stdin Progress options --text=STRING Set the dialog text --percentage=INT Set initial percentage --auto-close Close dialog when 100% has been reached --auto-kill Kill parent process if cancel button is pressed --pulsate Pulsate progress bar Question options --text=STRING Set the dialog text --no-wrap Do not enable text wrapping Text options --filename=FILENAME Open file --editable Allow changes to text Warning options --text=STRING Set the dialog text --no-wrap Do not enable text wrapping Scale options --text=STRING Set the dialog text --value=VALUE Set initial value --min-value=VALUE Set minimum value --max-value=VALUE Set maximum value --step=VALUE Set step size --print-partial Print partial values --hide-value Hide value Miscellaneous options -?, --help Show summary of options. --about Display an about dialog. --version Show version of program. Also the standard GTK+ options are accepted. ENVIRONMENT
Normally, zenity detects the terminal window from which it was launched and keeps itself above that window. This behavior can be disabled by unsetting the WINDOWID environment variable. EXAMPLES
Display a file selector with the title Select a file to remove. The file selected is returned on standard output. zenity --title="Select a file to remove" --file-selection Display a text entry dialog with the title Select Host and the text Select the host you would like to flood-ping. The entered text is returned on standard output. zenity --title "Select Host" --entry --text "Select the host you would like to flood-ping" Display a dialog, asking Microsoft Windows has been found! Would you like to remove it?. The return code will be 0 (true in shell) if OK is selected, and 1 (false) if Cancel is selected. zenity --question --title "Alert" --text "Microsoft Windows has been found! Would you like to remove it?" Show the search results in a list dialog with the title Search Results and the text Finding all header files.... find . -name '*.h' | zenity --list --title "Search Results" --text "Finding all header files.." --column "Files" Show an icon in the notification area zenity --notification --window-icon=update.png --text "System update necessary!" Display a weekly shopping list in a check list dialog with Apples and Oranges pre selected zenity --list --checklist --column "Buy" --column "Item" TRUE Apples TRUE Oranges FALSE Pears FALSE Toothpaste Display a progress dialog while searching for all the postscript files in your home directory find $HOME -name '*.ps' | zenity --progress --pulsate AUTHOR
Zenity was written by Glynn Foster <glynn.foster@sun.com>. This manual page was written by Ross Burton <ross@burtonini.com>. SEE ALSO
gdialog(1), dialog(1) February 1st, 2003 ZENITY(1)
All times are GMT -4. The time now is 03:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy