My script to replace strings in ASCII files
    Parv 
    parv at pair.com
       
    Wed Jan 11 15:14:00 PST 2006
    
    
  
in message <200601112047.k0BKlObZ019514 at clunix.cl.msu.edu>,
wrote Jerry McAllister thusly...
>
> > Just curious, what do I need to do to be able to execute this
> > script like:
> > 
> > $ text-replace old_string new_string
> 
> Check out tr(1).
> It does a good job of it with very simple rules.
...
> >             sed -i '' "s/old/new/g" "$file"
tr(1) takes a *set of characters* in a string, not the given string
as it is, to "translate characters" ..
  echo 'polka dot' | tr 'pol' 'x'
... in the OP's context, above should produce "xka dot" but produces
instead "xxxka dxt".
  - Parv
-- 
    
    
More information about the freebsd-questions
mailing list