It is not sed, but this ought to work...

perl -pi -e 's/Templates//sgi'    /path_to_directory_containing files/*

You could also (recommended) have it create a backup file for every file
edited
(Google perl command line editing) or you could also find all the files
containing
the word templates and process only those.. e.g.

perl -pi -e 's/Templates//sgi' `grep -l "Templates"
/path_to_directory_containing files/*`

Disclaimer - the above examples are just off the top of my head and have not
been double-checked for accuracy, fitness for purpose, effectiveness, or
anything
else. Use at your own risk.

John

Ryan Langseth wrote:
>
>
> Its been awhile since I used sed,  and I can not figure out to read
> and write to the same file.  Since you are doing this with a backup of
> the files, correct?  Here is a way to make it work
>
> mkdir newfiles
> for file in `ls .`; do
> sed -e 's|../../Templates/||g'  <$file  >newfiles/$file
> echo ------------------------------------------------
> done
>
> The edited files will be in "newfiles/"
>
> Note:  I used | instead of / for the delimiter,  sed can use different
> delimiters as long as you are consistent in the script.
>
> http://www.grymoire.com/Unix/Sed.html
>
> Ryan
>
>
> On Dec 15, 2007, at 10:02 AM, Mike Hammett wrote:
>
>> I'm not looking to remove the files, but to remove the text string
>> "../../Templates/" from those files.
>>
>>
>> -----
>> Mike Hammett
>> Intelligent Computing Solutions
>> http://www.ics-il.com
>>
>>
>> ----- Original Message ----- From: "Mike Hammett"
>> <[EMAIL PROTECTED]>
>> To: "WISPA General List" <wireless@wispa.org>
>> Sent: Saturday, December 15, 2007 9:45 AM
>> Subject: [WISPA] Linux command question
>>
>>
>> Would the following command remove ../../Templates/ from all files in
>> the /home/devicsil/public_html/Templates directory?
>>
>>
>>
>> for file in ls /home/devicsil/public_html/Templates ; do
>>
>> sed -e 's/..\/..\/Templates\///g' "$file"
>>
>> echo ----------------------------------------------------------------
>>
>> done
>>
>>
>>
>> -----
>> Mike Hammett
>> Intelligent Computing Solutions
>> http://www.ics-il.com
>>
>>
>>
>> --------------------------------------------------------------------------------
>>
>> WISPA Wants You! Join today!
>> http://signup.wispa.org/
>> --------------------------------------------------------------------------------
>>
>>
>> WISPA Wireless List: wireless@wispa.org
>>
>> Subscribe/Unsubscribe:
>> http://lists.wispa.org/mailman/listinfo/wireless
>>
>> Archives: http://lists.wispa.org/pipermail/wireless/
>>
>>
>>
>> --------------------------------------------------------------------------------
>>
>> WISPA Wants You! Join today!
>> http://signup.wispa.org/
>> --------------------------------------------------------------------------------
>>
>> WISPA Wireless List: wireless@wispa.org
>>
>> Subscribe/Unsubscribe:
>> http://lists.wispa.org/mailman/listinfo/wireless
>>
>> Archives: http://lists.wispa.org/pipermail/wireless/
>
>
>
> --------------------------------------------------------------------------------
>
> WISPA Wants You! Join today!
> http://signup.wispa.org/
> --------------------------------------------------------------------------------
>
>
> WISPA Wireless List: wireless@wispa.org
>
> Subscribe/Unsubscribe:
> http://lists.wispa.org/mailman/listinfo/wireless
>
> Archives: http://lists.wispa.org/pipermail/wireless/
>
>

-- 

John Vogel - [EMAIL PROTECTED]
http://www.vogent.net   620-754-3907
Vogel Enterprises, LLC
Information Services Provider serving S.E. Kansas



--------------------------------------------------------------------------------
WISPA Wants You! Join today!
http://signup.wispa.org/
--------------------------------------------------------------------------------
 
WISPA Wireless List: wireless@wispa.org

Subscribe/Unsubscribe:
http://lists.wispa.org/mailman/listinfo/wireless

Archives: http://lists.wispa.org/pipermail/wireless/

Reply via email to