I have problem to correctly display results from variable. When I use code as below then results are in one line as below.
httpd=`ps -wweo uname,pid,pcpu,pmem,args | sed -e 's|/usr/pw/apache/bin/httpd.*|httpd|' | grep -E -w 'httpd' | grep -v 'grep' | grep -v 'sed' | sed -r 's/[[:blank:]]+/;/g'`
echo $httpd
user;6374;0.0;0.0;httpd user;12571;0.0;0.0;httpd user;26473;0.0;0.0;httpd user;29933;0.0;0.0;httpd user;31980;0.1;0.0;httpd
Without variable results are OK and this is what I execpted
ps -wweo uname,pid,pcpu,pmem,args | sed -e 's|/usr/pw/apache/bin/httpd.*|httpd|' | grep -E -w 'httpd' | grep -v 'grep' | grep -v 'sed' | sed -r 's/[[:blank:]]+/;/g'
user;6374;0.0;0.0;httpd
user;12571;0.0;0.0;httpd
user;22984;0.0;0.0;httpd
user;26473;0.0;0.0;httpd
user;29933;0.0;0.0;httpd
Is there any trick to fix my results? Thank you