[Techtalk] command line

Carla Schroder carla at bratgrrl.com
Sat Mar 20 00:02:36 EST 2004


On Friday 19 March 2004 10:53 pm, jennyw wrote:
> There's probably a better way, but ... If the first line in each .php file
> is <head>, you could try:
> 
> perl -p -i.bak -e "s/<head>/line-of-php-code<head>/;" *.php
> 
> The .bak is to make backup copies with .bak as the extension in case
> something goes wrong.
> 
> Jen

Haha, great minds, I just posted something similar in Newchix. Except I didn't 
use .bak, which is a lovely idea. I would change one thing, you can add a 
newline:

$ perl -p -i.bak -e "s/<head>/line-of-php-code\n<head>/;" *.php

Assuming you wanted <head> on its own line, of course.

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Great boat for sale! 16' Smokercraft Osprey! 
Trailer, live well, fish finder, stuff!
http://www.tuxcomputing.com/boat

Carla Schroder
this message brought to you
by Libranet 2.8 and Kmail
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



More information about the Techtalk mailing list