[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Uninstall (nearly) everything installed after spacific date

Joe Hart wrote:
Hash: SHA1
Tyler Smith wrote:
On 2007-03-18, Joe Hart <j.hart@orange.nl> wrote:
ls -lt  /var/lib/dpkg/info/*.list | awk -F"/" '{print $6}' | awk -F"."
'{print $1}' > list.txt

will give you a list of packages in cronological order.  That you can
then edit and feed to apt-get.  Like I said, I don't know why you want
to do it, but I found it fun creating that line.

I'm just getting started with awk, but this seems to work:

ls -lt /var/lib/dpkg/info/*.list | sed 's/.*\(200[0-9]\)/\1/g' | awk '$0 > "2007-03-01"' | awk -F"/" '{print $6}' | awk -F"." '{print $1}' > list.txt

This produces a list of packages altered after 2007-03-01. You can
change that date around, or extend it to select a particular hour or
minute on that day to use as the cut-off.
Note that I have no idea what you're doing, or how dpkg works, I just
wanted to see if I could figure out a solution to the immediate
problem with sed and awk!

Now that's what I call a command!  Good job Tyler.  I hope Bob likes it.

Fantastic, thanks very much, you've inspired me, now I'm going to read the man pages and workout how those commands work, I've always found sed & awk a bit intimidating but they're obviously very powerful for list processing which I seem to do a lot, I find that starting with a working command or script and pulling it apart is the best way to learn.

As for why I'm doing this, well I have a PC which is ultimately earmarked to be a headless MythTV BackEnd but I've been using it to experiment with packages to figure out which ones I like for my personal desktop and also for a couple of old P!!!s I have as MythTV FrontEnds and would like to guests girlfriends and me to be able to surf the web and edit a document at, consequently it has lodes of stuff installed on it that I don't want, I was just about to reinstall Etch to clear it when I thought this way would be an interesting learning experience and a challenge for me, this list and apt.

Ultimately if it doesn't work I'm running apt-proxy on my file server so a reinstall doesn't take long.

Thanks for all your help I'll post my results

Reply to: