Date: Tue, 17 Feb 2004 19:03:42 -0600 (CST) From: "Jack L. Stone" <webster@sageweb.net> To: freebsd-questions@freebsd.org Subject: Using SED in a script Message-ID: <20040217183030.N52674@sageweb.net>
next in thread | raw e-mail | index | archive | help
Sorry if this is somewhat OT, but I *think* I have a simple SED(1) question for those familiar with its use. I am working up a small script that will grep(1) a string like "215 new messages" from a file for use as a variable. I need to then find/replace an "old string" in another file that may say "198 new messages" with the new variable string "215 new messages". So, only the numeric part of the string actually changes. I've looked at the sed approach, but not sure how to apply its use here, or if something else besides sed(1) would be better. This would be the steps: - grep(1) the new string and pipe to sed(1) ..?? - sed(1) to find the old string & replace with the new string in a file. Am I on the right track....?? Tips on the script syntax appreciated. Thanks and.... Happy Trails, Jack L. Stone SageWeb
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040217183030.N52674>