* Michael Heldebrant ([EMAIL PROTECTED]) [011121 13:38]: > On Wed, 2001-11-21 at 03:19, Vineet Kumar wrote: > > | sed -e "s/'\(.*\)'/\1/" > > Just to make sure I grok this fully: > > We're splitting the line into a beginning ', the matching regexp pattern > of any character as many times as we want, followed by a closing '. > Then we strip the ' by just substituting the regexp matched portion with > the \1 argument.
You got it. > I still don't quite understand why the syntax I was using wasn't working > but this is my first foray into sed. I had assumed sed would match any > and all ' and replace them with null. Or does the regexp syntax stop > with the first match per line? Right. the s/// command takes some flags after the final /; one of them is g, which indicates global substitution. In plainer terms, this means to match all occurrences on a line rather than just the first. So you could have written it like |sed -e "s/'//g" > > That removes the ticks from the first single-quoted expression in a > > line. Simpler still (to just remove any ticks): I realize also, now, that my above description is slightly inaccurate: what the sed command I gave before would do is to remove the first and last 's from a line, not the ones surrounding the first quoted expression. This is because regex matches are greedy, and ' matches .* . To strictly follow the description I gave (remove quotes from first single-quoted expression): |sed -e "s/'\([^']*\)'/\1/ That will match an opening ', any number of non-' characters followed by a ', and replace that whole thing with just the insides of the '...' > > apt-get install $yourpackages --print-uris -y --reinstall | tail +5 | > > awk '{print $1} | wget -i - > > Slightly complicated command line but it gets the job done. Perhaps > this functionality can be integrated into apt as a --redownload switch > or something. Worth filing a wishlist bug against it? I know of (but haven't used enough to speak of its functionality) a --download-only option; might this be able to get the job done when combined with --reinstall? Give it a shot. If it doesn't work, and you'd like to see the feature, go ahead and file the wishlist item. (Couldn't hurt.) good times, Vineet -- Satan laughs when # "I disapprove of what you say, but I will we kill each other. # defend to the death your right to say it." Peace is the only way. # --Beatrice Hall, The Friends of Voltaire, 1906
pgplkct8e8t6u.pgp
Description: PGP signature