Sponsored Content
Top Forums Shell Programming and Scripting Reading a table in a shell script Post 302084361 by luiscarvalheiro on Thursday 10th of August 2006 03:55:33 PM
Old 08-10-2006
Reading a table in a shell script

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 is reading, for each line, the data contents of col1 and col 2 (assigning them to variables, instead of writing them to files), in order to do some processing with those results.

Does anyone have a clue on how to accomplish this task?
Many thanks in advance

Luis Carvalheiro
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Alter Table Shell Script

I want to add some columns to a existing tables through a shell script. Please help. (2 Replies)
Discussion started by: ankitgupta
2 Replies

2. Shell Programming and Scripting

How to connect DB2 table using shell script

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)
Discussion started by: dtidke
0 Replies

3. Shell Programming and Scripting

Script not reading Data from oracle table properly

Hi, I have a case where i am connecting to the oracle DB and reading a column value.... Script is in production...it was running fine,,,but suddenly now some times its started giving pain.... Script runs dailly....but sometimes its reading data from Oracle DB and sometimes its not rading the... (2 Replies)
Discussion started by: Sagarddd
2 Replies

4. Shell Programming and Scripting

Truncating table from a shell script

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)
Discussion started by: gunaah
2 Replies

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

6. Shell Programming and Scripting

Shell script to query Oracle table

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)
Discussion started by: ken002
2 Replies

7. Shell Programming and Scripting

Perl Script for reading table format data from file.

Hi, i need a perl script which reads the file, content is given below. and output in new file. TARGET DRIVE IO1 IO2 IO3 IO4 IO5 ------------ --------- --------- --------- --------- --------- 0a.1.8 266 236 ... (3 Replies)
Discussion started by: asak
3 Replies

8. Shell Programming and Scripting

Reading a table from shell

i want to do something like this from shell, for any user without having to enter any passwords i want to store the value in the option_value column into a variable select option_value from `$databasename`.`wp_options` where option_name="template"; what is the command i should use? ... (0 Replies)
Discussion started by: vanessafan99
0 Replies

9. Shell Programming and Scripting

Shell Script Table

Hi, 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... (3 Replies)
Discussion started by: scruffytramp
3 Replies

10. Homework & Coursework Questions

Help with pivoting table shell script

input file txt file 2000 1 name 2000 2 addr 2000 3 phone 2000 4 email 1000 1 name 1000 2 addr 1000 3 phone 1000 4 email 3000 1 name 3000 2 addr 3000 ... (4 Replies)
Discussion started by: senmatrix
4 Replies
ici::doc::pod3::sdrtable(3)				       ICI library functions				       ici::doc::pod3::sdrtable(3)

NAME
sdrtable - Simple Data Recorder table management functions SYNOPSIS
#include "sdr.h" Object sdr_table_create (Sdr sdr, int rowSize, int rowCount); int sdr_table_user_data_set (Sdr sdr, Object table, Address userData); Address sdr_table_user_data (Sdr sdr, Object table); int sdr_table_dimensions (Sdr sdr, Object table, int *rowSize, int *rowCount); int sdr_table_stage (Sdr sdr, Object table); Address sdr_table_row (Sdr sdr, Object table, unsigned int rowNbr); int sdr_table_destroy (Sdr sdr, Object table); DESCRIPTION
The SDR table functions manage table objects in the SDR. An SDR table comprises N rows of M bytes each, plus optionally one word of user data (which is nominally the address of some other object in the SDR's heap space). When a table is created, the number of rows in the table and the length of each row are specified; they remain fixed for the life of the table. The table functions merely maintain information about the table structure and its location in the SDR and calculate row addresses; other SDR functions such as sdr_read() and sdr_write() are used to read and write the contents of the table's rows. In particular, the format of the rows of a table is left entirely up to the user. Object sdr_table_create(Sdr sdr, int rowSize, int rowCount) Creates a "self-delimited table", comprising rowCount rows of rowSize bytes each, in the heap space of the indicated SDR. Note that the content of the table, a two-dimensional array, is a single SDR heap space object of size (rowCount x rowSize). Returns the address of the new table on success, zero on any error. void sdr_table_user_data_set(Sdr sdr, Object table, Address userData) Sets the "user data" word of table to userData. Note that userData is nominally an Address but can in fact be any value that occupies a single word. It is typically used to point to an SDR object that somehow characterizes the table as a whole, such as an SDR string containing a name. Address sdr_table_user_data(Sdr sdr, Object table) Returns the value of the "user data" word of table, or zero on any error. void sdr_table_dimensions(Sdr sdr, Object table, int *rowSize, int *rowCount) Reports on the row size and row count of the indicated table, as specified when the table was created. void sdr_table_stage(Sdr sdr, Object table) Stages table so that the array it encapsulates may be updated; see the discussion of sdr_stage() in sdr(3). The effect of this function is the same as: sdr_stage(sdr, NULL, (Object) sdr_table_row(sdr, table, 0), 0) Address sdr_table_row(Sdr sdr, Object table, unsigned int rowNbr) Returns the address of the rowNbrth row of table, for use in reading or writing the content of this row; returns -1 on any error. void sdr_table_destroy(Sdr sdr, Object table) Destroys table, releasing all bytes of all rows and destroying the table structure itself. DO NOT use sdr_free() to destroy a table, as this would leave the table's content allocated yet unreferenced. SEE ALSO
sdr(3), sdrlist(3), sdrstring(3) perl v5.14.2 2012-05-25 ici::doc::pod3::sdrtable(3)
All times are GMT -4. The time now is 09:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy