Date: Wed, 11 Jan 2006 18:13:43 -0500 From: Parv <parv@pair.com> To: Jerry McAllister <jerrymc@clunix.cl.msu.edu> Cc: questions@freebsd.org Subject: Re: My script to replace strings in ASCII files Message-ID: <20060111231343.GA28403@holestein.holy.cow> In-Reply-To: <200601112047.k0BKlObZ019514@clunix.cl.msu.edu> References: <f377343c7093.43c57793@broadpark.no> <200601112047.k0BKlObZ019514@clunix.cl.msu.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
in message <200601112047.k0BKlObZ019514@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 --
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060111231343.GA28403>