list db directory |grep alias |awk '{print "connect to ",$4}'
In a shell script the below line should display output as below
connect to <DATABASENAME>
but its throwing error like
Syntax Error The source line is 1.
The error context is
{print connect to, >>> } <<<
awk: 0602-502 The statement cannot be correctly parsed. The source line is 1.
Can somebody help to rectify this ? Is there any syntax error ?
Below is hte script which i m trying to for my requirement.If we run the highlighted part individually on database its running file and production accurate o/p
Expected
connect to XXXX
connect to YYYY
connect to ZZZ.
for line in `cat 1.txt`
do
echo @@@@@@@ YOU ARE IN HOST ${line} @@@@@@@@@ >> CRON-List
ssh -o ConnectTimeout=10 ${line} "ls '/home/prods/db2' |grep "^U"|sort|uniq" > I-List
for line1 in `cat I-List`
do
typeset -l line1
instance=$line1
ssh -o ConnectTimeout=10 ${line} "ksh -s <<EOF
sudo suudb $instance
echo $instance;>>file.out
db2 list db directory |grep alias |awk '{print "connect to " $4}'>>file.tmp"
done