I want to parse httpd_ from chkconfig output using python for loop or whatever the easy way.
[spatel@04 ~]$ /sbin/chkconfig --list| grep httpd_
httpd_A 0:off 1:off 2:on 3:on 4:on 5:on 6:off
httpd_B 0:off 1:off 2:off 3:on 4:on 5:on 6:off
httpd_C 0:off 1:off 2:on 3:on 4:on 5:on 6:off
I know how to do in bash but i want same thing in python.
[spatel@04 ~]$ for qw in `/sbin/chkconfig --list| grep httpd_ | awk '{print $1}'`
> do
> echo $qw
> done
httpd_A
httpd_B
httpd_C
How to do it in python? my python version is
[root@04 ~]# python -V
Python 2.4.3
/sbin/chkconfig --list | awk '/^httpd_/ { print $1 }'.forandgrepand backticks are not required.