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
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
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
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
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
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
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
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
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
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
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
COL(1) General Commands Manual COL(1)
NAME
col - filter reverse line feeds
SYNOPSIS
col [ -bfh ]
DESCRIPTION
Col reads the standard input and writes the standard output. It performs the line overlays implied by reverse line feeds (ESC-7 in ASCII)
and by forward and reverse half line feeds (ESC-9 and ESC-8). Col is particularly useful for filtering multicolumn output made with the
`.rt' command of nroff and output resulting from use of the tbl(1) preprocessor.
Although col accepts half line motions in its input, it normally does not emit them on output. Instead, text that would appear between
lines is moved to the next lower full line boundary. This treatment can be suppressed by the -f (fine) option; in this case the output
from col may contain forward half line feeds (ESC-9), but will still never contain either kind of reverse line motion.
If the -b option is given, col assumes that the output device in use is not capable of backspacing. In this case, if several characters
are to appear in the same place, only the last one read will be taken.
The control characters SO (ASCII code 017), and SI (016) are assumed to start and end text in an alternate character set. The character
set (primary or alternate) associated with each printing character read is remembered; on output, SO and SI characters are generated where
necessary to maintain the correct treatment of each character.
If the -h option is given, col converts white space to tabs to shorten printing time.
All control characters are removed from the input except space, backspace, tab, return, newline, ESC (033) followed by one of 7, 8, 9, SI,
SO, and VT (013). This last character is an alternate form of full reverse line feed, for compatibility with some other hardware conven-
tions. All other non-printing characters are ignored.
SEE ALSO
troff(1), tbl(1)
BUGS
Can't back up more than 128 lines.
No more than 800 characters, including backspaces, on a line.
7th Edition May 16, 1986 COL(1)