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

Re: Repairing a corrupted system When dselect Hick ups



also sprach Martin McCormick <martin@dc.cis.okstate.edu> [2005.02.11.1846 +0100]:
> 	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.

man, this is not my day. use [[:space:]] instead of [:space:].

> 	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.

it's basically a grep and sed combined: replace "[[:space:]]install"
at the end of the line with nothing and only print (-n inhibits
automatic printing) lines where the replacement took place.

you could also do it with grep and awk:

  grep '[[:space:]]install$' | awk '{print$1}'

but why spawn two processes when one suffices?

-- 
Please do not send copies of list mail to me; I read the list!
 
 .''`.     martin f. krafft <madduck@debian.org>
: :'  :    proud Debian developer, admin, user, and author
`. `'`
  `-  Debian - when you have better things to do than fixing a system
 
Invalid/expired PGP subkeys? Use subkeys.pgp.net as keyserver!

Attachment: signature.asc
Description: Digital signature


Reply to: