Re: Sed Replace Script

Quincey Robertson <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
Thanks. That worked.
Quincey



----- Original Message -----
From: Mark Edgar <[email protected]>
To: Quincey Robertson <[email protected]>
Cc: "[email protected]" <[email protected]>
Sent: Friday, April 20, 2012 1:44 AM
Subject: Re: Sed Replace Script

On Wed, Apr 18, 2012 at 2:00 PM, Quincey Robertson
<[email protected]> wrote:
> #! /bin/sed

Why this line?  I think you meant to use #!/bin/sh.

This should work, if I'm correctly guessing your intentions (and
assuming GNU sed's -i option is available):

find . -type f -name '*.py' -exec sed -i 's/python/python2.4/g' {} +

FYI: http://www.dwheeler.com/essays/filenames-in-shell.html is a great
article about properly handling filenames.

     -Mark
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.