![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| Passing the values to the secondary script when it invoked by primary script | venu_eie | UNIX for Advanced & Expert Users | 2 | 07-03-2008 08:10 AM |
| Passing the values to the secondary script when it invoked by primary script | venu_eie | Shell Programming and Scripting | 1 | 07-03-2008 07:16 AM |
| create a shell script that calls another script and and an awk script | magikminox | Shell Programming and Scripting | 0 | 06-26-2008 03:50 AM |
| help me in sending parameters from sqlplus script to unix shell script | Hara | Shell Programming and Scripting | 2 | 01-29-2008 03:31 PM |
| Shell Script: want to insert values in database when update script runs | ring | Shell Programming and Scripting | 1 | 10-25-2007 04:06 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
script help
Hi I wrote script to get column name and data type from table but its not giving what i expect . Code:
tab1=$1
if [ ! -f $tab1 ] ; then
echo "file1 not exist:$tab1"
fi
col1=`awk -F" " '/SET TABLE/{print substr($4,(index($4,".")+1))}1' $tab1 |egrep -iv 'create|journal|default|index'| sed -e 's/(//g' -e 's/)//g'|awk -F " " '{print $1 }'|awk NF`
len1=`awk -F" " '/SET TABLE/{print $4}1' $tab1 |egrep -iv 'create|journal|default|index'|awk -F " " '{print $2 }'`
echo "$col1 $len1\n"
a.sql
CREATE SET TABLE HIST ,NO FALLBACK ,
NO BEFORE JOURNAL,
NO AFTER JOURNAL,
CHECKSUM = DEFAULT
(
Id INTEGER NOT NULL,
Cd CHAR(10) CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL,
Category_Cd VARCHAR(5) CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL,
Start_Dt DATE FORMAT 'YYYY-MM-DD' NOT NULL,
Ind CHAR(1) CHARACTER SET LATIN NOT CASESPECIFIC,
End_Dt DATE FORMAT 'YYYY-MM-DD'
)PRIMARY INDEX ( Party_Id );
#gelcol.sh a.sql
HIST
Id
Cd
Category_Cd
Start_Dt
Ind
End_Dt
INTEGER
CHAR(10)
VARCHAR(5)
DATE
CHAR(1)
DATE
O/p should be
Id INTEGER
Cd CHAR(10)
Category_Cd VARCHAR(5)
Start_Dt DATE
Ind CHAR(1)
End_Dt DATE
Thanks, MR |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|