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/

Reply via email to