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

Re: Repairing a corrupted system When dselect Hick ups



	Using the commands

  dpkg --get-selections | sed -ne 's,[:space:]install$,,p' | \
    xargs apt-get install --reinstall --yes

	There is still a problem, so I took the liberty of taking them
apart to see what makes them tick.

  dpkg --get-selections  is certainly producing a long list of
packages most of which are reported as in stalled and some,
deinstalled.  This is good.  This output pipes to

| sed -ne 's,[:space:]install$,,p'

	sed is one of my favorite UNIX applications and I see examples
of expressions that I have read about but hadn't tried so this is a
good learning experience.  The -ne tells sed to quietly use the next field
which is the part in single quotes as a regular expression 
's,[:space:]install$,,p'

	Here's where I think a switch is in the opposite position so
to speak.  This produces a perfect list of every deinstalled package
on the system, some white space and then a single d.

	That is what is piped to xargs and I believe that is the
opposite polarity of logic.  What xargs should see is all the names of
what is installed and not those packages that aren't.

	The part of the sed expression I am not familiar with is the
very last part of the quoted block that says
$,,p  The white space before the word install is the trigger.

	This is elegant so I am learning much more here than how to
reconcile the package installation records.

	Thanks.

Martin McCormick WB5AGZ  Stillwater, OK 
OSU Information Technology Division Network Operations Group



Reply to: