Hi. I working in Windows using Cygwin, a UNIX emulator.
I'm trying to do what I did in UNIX a lot, replace text phrases in files in the current directory and all subdirectories. I have Cygwin, but can't get the syntax correct. If there is a better shell or a better way, I'd like to know that too .
I like emacs, so ideally I'd do this in an emacs shell on Windows XP.
the sed command I'd use has the form:
sed 's/\/lt\//\/lt4\//g' * > ???? ;replace "/lt/" with "/lt4/" and do this with files in all subdirectories too
So, for each file found it should make that replacement and put it back in the same file name. I also tried to break it up into a sed file and a find command:
find . -name "trial.*" -exec sedscript.sh {} \;
and I got this output:
[begin output]
starting
export: =: bad variable name
File = ./trial.cpp
export: =: bad variable name
cp missing file operand
Try cp <snip>
sedscript.sh: cannot create : directory nonexistant
rm missing operand
[end output]
my sedscript.sh file looks like this:
echo "starting"
export FILE = $1
echo "File = " $1
export TMPIN = "$FILE".tmp
cp $FILE $TMPIN
sed -e 's/\/lt\//\/lt4\//g' $TMPIN > $FILE
rm $TMPIN
so, I'm pretty much getting an error on every line. Ideas? Thanks!
Gene
ASKER
Gene