[nycbug-talk] sed Question

Scott Robbins scottro at nyc.rr.com
Thu Mar 30 18:09:54 EST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, Mar 30, 2006 at 05:52:56PM -0500, Kevin Reiter wrote:
> All,
> 
> I know there are a few scripting gurus on this list who might be able to 
> help me out with this..
> 
> I'm trying to write a script that does the following:
> 
> 1. Runs 'fastest_cvsup -c us' to find the fastest cvsup server
> 2. Assigns the value of "server.txt" (which is the fastest server) to a 
> variable and then searches my "ports-sup" file for the existing server, 
> and replaces it with the new one.

I did it this way.


#!/bin/sh 
FASTEST=$(fastest_cvsup -q -c us) 
sudo csup -h $FASTEST /usr/share/examples/cvsup/current-supfile 



However, before that I used to do (which seems more in line with what
you're doing, although still a bit different)


fastest_cvsup -c us > fcvs.txt
tail -3 fcvs.txt | head -1 | cut -d: -f2 > host
rm fcvs.txt
FASTEST=$(cat host)
sudo csup -h $FASTEST /usr/share/examples/cvsup/current-supfile 

You could of course, modify it for ports.  Rather than replacing the
server, I'm just using -h.


Hope this is of some use, even though it's not really answering your
question.



- -- 

Scott Robbins

PGP keyID EB3467D6
( 1B48 077D 66F6 9DB0 FDC2 A409 FA54 EB34 67D6 )
gpg --keyserver pgp.mit.edu --recv-keys EB3467D6

Buffy: I told you. I said end of the world. And you're like, 
'Pooh-pooh, Southern California, pooh-pooh.' 
Giles: I'm so very sorry. My contrition completely dwarfs the 
impending apocalypse. 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (FreeBSD)

iD8DBQFELGVC+lTVdes0Z9YRAtHzAKDCOM8pZVSrZuiTNJHJYNEfkEhSgwCeNC7s
8b9E2GCKCFOTicmXaolYTxc=
=yVGN
-----END PGP SIGNATURE-----



More information about the talk mailing list