newbie sed question

newbie sed question

Post by Peace Frog. » Wed, 21 Sep 1994 08:43:51



can someone show me how id go about stripping all the ansi colors from a
text file with sed?  ive tried several things but i learn much better
with examples than with manpages.. many thanks.
 
 
 

1. newbie sed question

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)

3. Newbie SED question

4. diald: problem starting sl0

5. newbie sed question

6. HELP: shell output not going to tty

7. simple newbie sed question

8. Please help with this ufsdump error message

9. Sed question for newbie

10. newbie grep/sed/awk and hd questions

11. Sed Search and Replace Newbie question

12. Newbie "sed" question

13. Sed / regex question from a newbie