for X in `ls -1`; do
  sed s/Search/Replace/g $X > $X.tmp
  mv $X.tmp $X
done

??

Backup, test, and backup again before trying it :)

On Thu, 2003-10-23 at 13:53, Chris Frederick wrote:
> Hey gang,
> 
> This may have been covered before, but I was wondering how I can find 
> and replace in files.  I've seen a couple of ways to do this, but the 
> ones I've tried are botched up in some way.  Here's an example of what 
> I'd like to do:
> 
> /dir contains about 150 files in it.
> egrep "/^[ \t]some (fancy[.]+regex).*$/" *.files  - shows 20 files with 
> matching lines.
> I'd like to "s/^[ \t]some .+(fancy.+regex).*$/\1/" on those files.
> 
> a script like this is doable:
> for file in dir
>     ex "+:g/find/s//replace/" "+:wq" file
> 
> but I can't help but think there's a better way, and one with more 
> features like being able to recurse through directories, or is faster, 
> etc.  Is there a egrep/grep/etc tool that can do this?  Or what tool 
> would you recommend?
> 
> Thanks in advance...
> Chris Frederick
> 
> 
> 
> _______________________________________________
> TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
> http://www.mn-linux.org tclug-list at mn-linux.org
> https://mailman.real-time.com/mailman/listinfo/tclug-list
> 


_______________________________________________
TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
http://www.mn-linux.org tclug-list at mn-linux.org
https://mailman.real-time.com/mailman/listinfo/tclug-list