[Techtalk] command line

jennyw jennyw at dangerousideas.com
Fri Mar 19 23:53:54 EST 2004


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

----- Original Message ----- 
From: "wolf" <wolf at wolfrising.net>
To: <techtalk at linuxchix.org>
Sent: Friday, March 19, 2004 8:10 PM
Subject: [Techtalk] command line


> Hi,
>
> Is there anyway from the command line to inject the same line of text
> into about 20 files
> in a directory? I have a php include file I would like to appear on the
> top of every .php
> file in a directory and I thought there might be a quick and easy way
> to paste it into each
> file via the command line as opposed to opening each file and pasting
> onto the top.
>
> _______________________________________________
> Techtalk mailing list
> Techtalk at linuxchix.org
> http://mailman.linuxchix.org/mailman/listinfo/techtalk
>



More information about the Techtalk mailing list