In the unix command line(sun solaris), when I enter the following command:
ps -ef|grep ScanFileClient|grep -v grep|tr -s ' '|cut -d ' ' -f 3,10,12
I get the result as:
5576 ScanFileClient CB123
5577 ScanfileClient CB124
However if I put the following same command in a ksh script:
for i in `ps -ef|grep ScanFileClient|grep -v grep|tr -s ' '|cut -d ' ' -f 3,10,12`;do
echo " $i Active"
done
I get the result as:
5576 Active
ScanFileClient Active
CB123 Active
5577 Active
ScanFileClient Active
CB124 Active
What is the difference?? All I wanted is the result should be
5576 ScanFileClient CB123 Active
5577 ScanFileClient CB124 Active
Any help will be appreciated.
jmanj
ps -ef|grep ScanFileClient|grep -v grep|tr -s ' '|cut -d ' ' -f 3,10,12
I get the result as:
5576 ScanFileClient CB123
5577 ScanfileClient CB124
However if I put the following same command in a ksh script:
for i in `ps -ef|grep ScanFileClient|grep -v grep|tr -s ' '|cut -d ' ' -f 3,10,12`;do
echo " $i Active"
done
I get the result as:
5576 Active
ScanFileClient Active
CB123 Active
5577 Active
ScanFileClient Active
CB124 Active
What is the difference?? All I wanted is the result should be
5576 ScanFileClient CB123 Active
5577 ScanFileClient CB124 Active
Any help will be appreciated.
jmanj