i need a bit help. I must write a script with shell- and sed-commands, which reads a table from stdin and writes a html-table on stdout (so i can open it with a web browser). The number of columns must be a parameter for the script, so i can start it for example with: "./htmltab.sh 3 <table-data". (sry if my english is bad)
Not much. I'm searching and reading the whole day but I don't know how to begin. It's difficult to me to understand the whole linux system with STDIN and STDOUT. I'm new with linux. I'm studying and the lessons and tasks we get in Scripting are not very well organised. We must write a script which reads a table like this:
Name \t Size \t Type
bla \t 4711 \t f i l e
abcde \t 4096 \t directory
and then writes a html-table. We got the structure for the html-table because we never worked with html, but it doesn't helps me a lot...it would be easier to explain the task in german...I know for example how to find and extract words from a text with 'sed' but not how I should read a table and convert it.
Standard input and output amount to pre-opened files. Usually, standard input is connected to your keyboard, and standard output is connected to your screen, but the shell lets you attach them to anything you want like this:
< redirects standard input. Any commands you run in that script, and the read builtin, will read from inputfile instead of the keyboard.
> redirects standard output. Any commands you run, and the echo builtin, will write to outputfile instead of the terminal.
So when they are telling you to read from standard input, they are telling you to just read from the default with read and feed whatever you want into it later.
You use read like
and if the first line is A B C D E, it effectively does VAR1="A"; VAR2="B" ; VAR3="C" ; VAR4="D E"
And 'standard output' just means 'print to the terminal with echo or whatever'.
We really can't give you a direct answer, we can give you the tools. And this should really be in the homework forum, please re-post there following the homework template.
Hi,
I'm an amateur and need your help in figuring this out. I have been asked to connect to a prod db from non-prod env., and download a table from prod db to non-prod env.
I was able to connect to the prod db and then run a simple query as below.
@@@@@@@@@@
... (7 Replies)
Hi, unix gurnis
I need help for following requirement for writing a shell scritp.
log in to oracle database, query one table total records (select count(*) from table1), pass the return value to a file.
Thanks in advance (2 Replies)
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)
I am trying to truncate a table using below script. When I ran the script it runs fine but table was not truncated and the spool is empty. I am not sure what is wrong with pl/sql block.
#!/bin/ksh
# ----------------------------------------------------------------------
#
# Created by: XXXX... (2 Replies)
Hi all,
I need to create a matrix of variable rows and columns. Right now i have 3 rows and two columns and following values.
Output something like
TypeA TypeB
TestCase1 Pass Fail
TestCase2 Pass ... (2 Replies)
Hi All,
I want to connect two tables in DB2 using shell script and then compare the contents of two tables field by field. Could any one please help me in connecting database tables using Unix and retriving data from the same.
Thanks,
Durwas (0 Replies)
Dear all:
I want to write a script capable of reading specific rows and collumns of a table, into a variable.
Just imagine i have a file named table.dat which contains:
GENERAL INFORMATION
Col 1 Col2 Col3
1 1
2 2
3 3
4 4
What i want to do... (13 Replies)
Hi,
For one of my programs, I need to have a hashtable as in Perl. Unfortunately shell doesnt provide any variable like hash. Is there anyway/trick, I could implement a hash in shell (using shell scripts/sed/awk).
JP (2 Replies)