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

Re: [Sheflug] sed Help



On Wed, Aug 28, 2002 at 10:15:24AM +0100, Chris J wrote:
> If you're using a ridiculously powerful tool like perl to do simple
> substitution, I can use awk :P (i.e., they were probably all useless uses of
> perl :-) ).

Well, indeed :-)

> > If we're talking arcana, then:
> >
> > 	yes '/mnt/home/aland' | paste -f -d'/' - oldfile.py > newfile.py
> 
> Doesn't work - I've tried it already :) Well it does work, but because yes
> prints out ad infinitum, paste will continue ad infinitum, so you need to
> pipe the result through "head -n `wc -l < /etc/passwd`".

No, no, no, you need an upgrade my friend. The missing '-f' switch that
you were wondering about is 'halt on first eof' - so although yes
constructs an infinite list, so long as oldfile.py is finite you're 
okay :)

apt-get install ..etc...

> Alternatively you could do "vi infile" then type "0,$ s/^/whatever/"
> followed by ":wq".
> 
> Gotta love UNIX ;)

TMTOWTDI :)

Cheers,

Alex.

___________________________________________________________________

Sheffield Linux User's Group -
http://www.sheflug.co.uk/mailfaq.html

  GNU the choice of a complete generation.