I know this question must be asked weekly. I need to replace a string of
text in a group of files. SunOs 4.1.3, csh.
Here's what I've got so far:
% more glr
#!/bin/csh
# glr - global text replace script
set STXT = $1
set RTXT = $2
set FILELIST = $3
foreach f ($FILELIST)
sed "s/$STXT/$RTXT/g" $f > /tmp/TEMP_$f
mv -f /tmp/TEMP_$f $f
end
%
Part of my problem is the handling of $3, it should be a list
of files. But, only one filename is stored in the variable;
yes, there are several files that match the wildcard.
The other problem is the actual sed statement; it doesn't
work at all, as far as I can tell. I want to be able to
type something simple like:
% glr old_text new_text files*
Please send me mail, I'll reply a compilation of responses.
Thanks,
Kevin
--
Kevin Werner Phone: 317 / 451-9749
IC Test Development Engineer Fax: 317 / 451-8876
2. (none)
4. diald: problem starting sl0
6. HELP: shell output not going to tty
8. Please help with this ufsdump error message
10. newbie grep/sed/awk and hd questions
11. Sed Search and Replace Newbie question
13. Sed / regex question from a newbie