Hi,
Please let me know how can we declare in shell script similar to rowtype in the oracle.
For example we have below data in table "info"
Name Age Address
James 25 Newark
James 5 Newyork
James 29 NewJersy
James 25 Pheonix
We can specify in oracle as
declare test info.rowtype
How can we do something similar to that if we have same data in the file in SHELL?
Thanks in advance,
Srini
panyam
September 9, 2009, 5:46am
2
Hi Srini ,
Welcome to the Forum .
You can put that complete row in a normal shell variable.
No specific type required as we do in oracle.
Hi,
Thanks for the reply. Its my first post in this forum.
Iam new to shell script.
So can you give me an example for this operation considering that data i have specified is stored in the file "info.txt". Please let me know how to open that file and read the first row and assign it to a variable and retrieve back the second column's data from that variable.
panyam
September 9, 2009, 6:48am
4
informsrini:
Hi,
Thanks for the reply. Its my first post in this forum.
Iam new to shell script.
So can you give me an example for this operation considering that data i have specified is stored in the file "info.txt". Please let me know how to open that file and read the first row and assign it to a variable and retrieve back the second column's data from that variable.
some thing like this :
while read line
do
echo "$line" ## print each line
echo "$line" | awk '{ print $2}' ## to get the second filed
done < file.txt ## read from the file
Thanks for the help. It works well:b:
By
Srini