Entering edit mode
3.6 years ago
terry.walters
•
0
I have a file that contains the following line that is the input to a SYBASE query. where so.name = "tablename" I run this query in a shell script within a for loop. I am attempting to get all the column names in each table in a SYBASE ASE database. My for loop is something like this
for tablename in `cat $TBLNAME.$DBNAM.out
do
awk '$1=="where"{$4="\"$tablename\""}1' $CLMNSQL . tmp2 && mv tmp2 $CLMNSQL
get_column_names
done
the data in $TBLNAME.$DBNAM.out looks something like this
tbaccessfilter
tbbillingrules
tbconcurrentusers
tbconfigaudit
tbconfigname
tbconfiguration
tbcustomer
tbcustomersdomtype
tbcustomersshippingtype
My question is how do I relpace the "tablename" in the file $CLMNSQL with what is contained in the $tablename variable in my awk statement, because what I have there does not work? What would the sed command look like if i use sed instead?