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

Re: Uninstall (nearly) everything installed after spacific date

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 getting better with awk.  :)
> That command should be all one line.  I can't quite figure out how to
> get it to pull only after a certain date.  It does them all.

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!


Tyler Smit

Reply to: