The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to Read config (.cfg) files using shell scripting smallwonder UNIX for Advanced & Expert Users 5 03-02-2007 12:37 AM
rename files using shell scripting gfhgfnhhn Shell Programming and Scripting 4 07-04-2006 05:37 PM
why shell scripting takes more time to read a file brkavi_in Shell Programming and Scripting 1 06-23-2006 09:20 AM
How to write Flat Files by shell script using Oracle Database coolbuddy UNIX for Advanced & Expert Users 3 02-21-2006 02:50 PM
How To create Flat Files using Unix Shell Script? Aparna_k82 Shell Programming and Scripting 4 02-10-2005 05:49 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 03-31-2009
shijoe shijoe is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 3
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

Code:
#!/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

Last edited by Yogesh Sawant; 04-01-2009 at 02:40 PM.. Reason: added code tags
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:25 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0