how read the flat files from shell scripting


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users how read the flat files from shell scripting
# 1  
Old 03-31-2009
how read the flat files from shell scripting

We are using sybase data base and we have the data base name called MasterDB. The data baase MasterDB contains 100's of tables like sample1, sample2, sample3...etc...sample100
To take the count of every table we have to execute the following commands
use MasterDB //DB name
go //execute command in sybase
select count(*) from sample1 // command to find the count of table
go //execute the command

This is the way to take count. Likewise manually we have to take 100 tables count...we have to automates this though shell scripts.
What I did here is, I write all table names in the flat file and trying to read the flat files from the scripts
#!/bin/ksh
PATH=temp/flat_file
srv=sybaseserver
uid=operator
log=$LOGS/rowcount.log
pwd=`cat $SYBASE/.operatorpwd`
CP_CONN="-U$uid -S$srv -C3433 -b100000"
echo "count of table Started at: `date`" > $log
echo >> $log
echo "-------------------------------------------------------" >> $log
echo 'Setting table count..' >> $log
isql -U$uid -S$srv << EOF >> $log
$pwd
use customers
go
print 'taking count from tables..'
go
while read line
do
select count(*) from $customer_table \n
go
done < outfile.dat
i know its incorrect logic..pls help me onthis
# 2  
Old 03-31-2009
I am closing this thread. It is a duplicate of a thread in the Shell Programming and Scripting forum.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies

2. Shell Programming and Scripting

How to add trailer record at the end of the flat file in the unix ksh shell scripting?

Hi, How to add trailer record at the end of the flat file in the unix ksh shell scripting can you please let me know the procedure Regards Srikanth (3 Replies)
Discussion started by: srikanth_sagi
3 Replies

3. Shell Programming and Scripting

Request for file read option in Unix shell scripting

Hi Friends, I would like to read all the record from one txt file to other file txt For example I have two txt file a.txt and b.txt. I need to read a.txt record by record and I need add the system date @ end of each record before moving it to b.txt. Could you please share the coding for... (4 Replies)
Discussion started by: vinoth124
4 Replies

4. Programming

Scripting using flat files

I need some help to create a script that can do the following: I have two flat files with one column that should link the two files' information into one record: 1st Flat File - 3 columns, multiple rows: orderid, Jobnumber, Ordernumber 2nd Flat File - 2 columns, multiple rows: ... (4 Replies)
Discussion started by: Lavelle
4 Replies

5. Shell Programming and Scripting

reading fixed length flat file and calling java code using shell scripting

I am new to shell scripting and I have to to the following I have a flat file with storename(lenth 20) , emailaddress(lenth 40), location(15). There is NO delimiters in that file. Like the following str00001.txt StoreName emailaddress location... (3 Replies)
Discussion started by: willywilly
3 Replies

6. Shell Programming and Scripting

how read the flat files from shell scripting

We are using sybase data base and we have the data base name called MasterDB. The data baase MasterDB contains 100's of tables like sample1, sample2, sample3...etc...sample100 To take the count of every table we have to execute the following commands use MasterDB //DB name go //execute... (1 Reply)
Discussion started by: shijoe
1 Replies

7. UNIX for Advanced & Expert Users

How to Read config (.cfg) files using shell scripting

Hello Friends I am new to this forum and this is my first post. I have to write a script in which i have to read data from a configuration ( .cfg) file. And also i have to execute/call some already written scripts from this script. Can you people plpease help me on this regards. Thanks... (5 Replies)
Discussion started by: smallwonder
5 Replies

8. Shell Programming and Scripting

why shell scripting takes more time to read a file

i have done a coding in shell scripting which reads a file line by line and does something....it takes more than 30 seconds to execute for a single file. when i do the same with perl scripting it takes less than a second. is that shell scripting is not efficient while working with large number of... (1 Reply)
Discussion started by: brkavi_in
1 Replies

9. UNIX for Advanced & Expert Users

How to write Flat Files by shell script using Oracle Database

Hello There.. I came to a situation where I need to write flat files using shell scripts, I need to pull the records from the oracle database and create the flat file, This process should be automated. Can any shell script expert out here to help me.. please.. Will be really glad to... (3 Replies)
Discussion started by: coolbuddy
3 Replies

10. Shell Programming and Scripting

How To create Flat Files using Unix Shell Script?

Hi all, How to create Flat Files using Unix Shell Script. The Script is supposed to be sheduled to run at a particular time? Thanks in advance Appu (4 Replies)
Discussion started by: Aparna_k82
4 Replies
Login or Register to Ask a Question