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

Re: downloading with apt-get --download-only install package



On Wed, 2001-11-21 at 03:19, Vineet Kumar wrote:
> * Michael Heldebrant (hmike@portalofevil.com) [011120 12:17]:
> > On Tue, 2001-11-20 at 11:56, Michael A. Miller wrote:

> > 
> > sed -e "s/'\$//"|sed -e "s/'//" Strips them both off, but the last
> > version of the sed command only strips the first ' off and trying to
> > combine them isn't working for me with (|) syntax.  Maybe a regexp or
> > sed guru could give me a pointer.
> 
> IANAG, but I can give a few pointers. At a shell prompt, you can remove
> the single quotes from stdin in this situation in a couple of ways:
> 
> | 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.

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?

> 
> That removes the ticks from the first single-quoted expression in a
> line. Simpler still (to just remove any ticks):
> 
> | tr -d "'"

This is the simpler solution I see now.  But I think learning sed is
more usefull in the long run for other text trickery.

> 
> for your particular case, though, to just avoid having to use a temp
> file, and given that it doesn't complain about getting single quotes
> anyway, just tell wget to read from stdin by specifying - as its input
> file:
> 
> 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?

--mike



Reply to: