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

Re: [Sheflug] sed Help



On Tue, Aug 27, 2002 at 11:24:43PM +0100, Dawson, Alan wrote:

> I have a text file which needs a common string appending to the beginning of
> every new line.  I'm sure sed would be my friend here but I'm afraid i dont
> speak the same language - yet -.

I don't talk sed either, but I know what I'm doing with perl...

> string = "/mnt/home/aland/"
> 
> oldfile.py looks like 
> 
> dontmeanathingifitaintgotthatswing.mp3
> bitchesbrew.mp3
> giantsteps.mp3
> 
> I would like newfile.py to look like
> 
> /mnt/home/aland/dontmeanathingifitaintgotthatswing.mp3
> /mnt/home/aland/bitchesbrew.mp3
> /mnt/home/aland/giantsteps.mp3

$ perl -pe 's!^!/mnt/home/aland/!' oldfile.py > newfile.py

should do the trick nicely.

Dave
-- 
"A blackened shroud, a hand-me-down gown of rags and silks, a costume fit for
 one who sits and cries for all tomorrow's parties" - The Velvet Underground
http://www.cpio.org/~grimoire | http://www.livejournal.com/~diffrentcolours
___________________________________________________________________

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

  GNU the choice of a complete generation.