View Single Post
Posts: 197 | Thanked: 91 times | Joined on Dec 2010
#3
This works in python to parse /var/lib/dpkg/status for installed files (quick and dirty):

Code:
ff = open('a','r')
a = ff.readlines()
pac = []
for i,l in enumerate(a):
    s = l.split(' ')
    if s[0] == 'Status:':
        if s[-1] == 'installed\n':
            print s
            pac.append(a[i-1].split(' ')[1].strip('\n'))
p = ' '.join(pac)
print p
(working on the rest in the meantime)