[sf-lug] NEED INFO ABOUT BOOT SECTOR, SPACE LIMITS
Alex Kleider
akleider at sonic.net
Tue Aug 1 09:39:25 PDT 2017
On 2017-08-01 00:33, Rick Moen wrote:
> Here's some other stuff from SVLUG's Web team documentation on
> www.svlug.org. (I have no doubt it can be spiffed up, as it's a little
> old.) For annoying historical reasons and against my preference,
> it runs Ubuntu Server.
Thanks, Rick, once again, for the info.
>
> dpkg -l | less # You'll want a wide window for this.
Yes, the output is very difficult to read and even with the widest
window possible on my laptop, all the lines ran over so I came up with
the following little script that might be of use to others.
#!/usr/bin/env python3
# File: dpkg.py
"""
Assumes INFILE is the text output of the
sudo dpkg -l
command which typically spits out very long lines.
Lines are read and those longer than END have the part
between START and END deleted. Others are left unchanged.
Resulting lines are sent to stdout.
Typical usage:
chmod 755 dpkg.py # To set the executable bit.
sudo dpkg -l > dpkg.txt # Run the command saving output.
./dpkg.py > dpkg.short # Delete version info to shorten lines.
vim dpkg.short # Here you see the (shortened) output.
rm dpkg.txt dpkg.short # Clean up after you're done.
START and END are currently defined to eliminate the version
information but this can of course be modified to suit.
"""
INFILE = 'dpkg.txt'
START = 58
END = 110
# print("Part to delete is between {} and {}." .format(START, END))
with open(INFILE, 'r') as in_file:
for line in in_file:
if len(line) > END:
line = line[:START] + line[END:]
print(line.strip())
More information about the sf-lug
mailing list