Re: My script to replace strings in ASCII files



in message <200601112047.k0BKlObZ019514@xxxxxxxxxxxxxxxxx>,
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

--

_______________________________________________
freebsd-questions@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: Dynamically switch Javascript
    ... A call gets made to a server, and it returns a string. ... I need to be able to execute this Javascript and place its contents inside the "div" tag. ... I have tried using "eval" and also constructing a script node dynamically and both have not worked for me. ... The only browser that executes script blocks that are inserted via innerHTML is NS6 and not all releases of NS6 execute them. ...
    (comp.lang.javascript)
  • Re: basic help to run an application from WSH
    ... The Run method requires at least one argument, which is a string. ... string values must be enclosed in quotes. ... The Run method will execute on c:\notepad.exe. ... I'm just learning vbscript for wsh and here is my first script, ...
    (microsoft.public.scripting.vbscript)
  • Re: Creation of DSN
    ... Build a text string from the input data. ... rather execute the string that was just built. ... script file has been processed. ... > I'm using directly a Command, ...
    (microsoft.public.vb.database.ado)
  • Executing python script stored as a string
    ... how to execute a python script stored as a string? ... the script in string should behave just like any other ordinary ... about a function caller "up". ... Think of it as a text editor with a special ability to execute its ...
    (comp.lang.python)
  • Re: How to rewrite with awk?
    ... > I'm unfamiliar with tools such as sed & awk. ... Extract the string that matches a RE. ... This script will not only expand all the lines that say "include ... file) and not resetting ARGV(the tmp file), it then lets awk do any ...
    (comp.unix.shell)