If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > How to resolve this problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-05-04, 05:01
newhu114 newhu114 is offline
Registered User
 
Join Date: Jul 2004
Posts: 17
How to resolve this problem

Following is my shell :
d=$(date "+%y:%m:%d:%H:%M:%S")
i=0
for dbname in $(cat $MONCONF/db_name|head -n 200)
do (
result=`remsh dbsvr1 ". /home/db2inst2/sqllib/db2profile;db2 get snapshot for all on $dbname"`
echo $result|grep "High water mark for connections">1.txt
)
((i=i+1))
done

when I execute this shell,the error is generated:
grep: 0652-226 Maximum line length of 2048 exceeded.
How to resolve it?
Thanks!
Reply With Quote
  #2 (permalink)  
Old 08-05-04, 05:28
Damian Ibbotson Damian Ibbotson is offline
Padawan
 
Join Date: Jun 2002
Location: UK
Posts: 525
remsh dbsvr1 ". /home/db2inst2/sqllib/db2profile;db2 get snapshot for all on $dbname" | grep "High water mark for connections">1.txt

or

result=`remsh dbsvr1 ". /home/db2inst2/sqllib/db2profile;db2 get snapshot for all on $dbname"`
echo "$result" |grep "High water mark for connections">1.txt
Reply With Quote
  #3 (permalink)  
Old 08-05-04, 08:26
newhu114 newhu114 is offline
Registered User
 
Join Date: Jul 2004
Posts: 17
It is done.
However,when I modify the shell as followings:
d=$(date "+%y:%m:%d:%H:%M:%S")
i=0
for dbname in $(cat $MONCONF/db_name|head -n 200)
do (
result=`remsh dbsvr1 ". /home/db2inst2/sqllib/db2profile;db2 get snapshot for all on $dbname"`
echo $result|grep -E "High water mark for connections|database name">1.txt
)
((i=i+1))
done

the following error occurs.
./db2_connect.sh[10]: 0403-029 There is not enough memory available now.
./db2_connect.sh[6]: 0403-029 There is not enough memory available now.
grep: 0652-226 Maximum line length of 2048 exceeded.

Why?
What's the differenc between "$result" and $result?
Reply With Quote
  #4 (permalink)  
Old 08-05-04, 08:47
Damian Ibbotson Damian Ibbotson is offline
Padawan
 
Join Date: Jun 2002
Location: UK
Posts: 525
Quotes are *very* important in Unix. You should probably read up on them because the way you quote anything, using single quotes, double quotes, backticks and/or any combination of these can produce completely different results.

In this example, not quoting $result, causes the shell to perform variable expansion on $result, the resulting string is then tokenised using the values held in the environment variable $IFS ( by default a space, a tab and a newline ). Effectively, this means that all the spaces, tabs and newlines in $result would be lost and replaced with a single space. Using quotes would cause $result to be treated as a single token, thus retaining the embedded spaces, tabs and newlines.

e.g.

$ var="a
$ b
$ c"
$ echo $var
a b c
$ echo "$var"
a
b
c
Reply With Quote
  #5 (permalink)  
Old 08-05-04, 10:47
newhu114 newhu114 is offline
Registered User
 
Join Date: Jul 2004
Posts: 17
thanks a lot.
I have understand the importance of double quota.
However,how to resolve this problem
the following error occurs.
./db2_connect.sh[10]: 0403-029 There is not enough memory available now.
./db2_connect.sh[6]: 0403-029 There is not enough memory available now.
grep: 0652-226 Maximum line length of 2048 exceeded.

Why?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On