[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: grep and substitute tool?



-----BEGIN PGP SIGNED MESSAGE-----


I think you mean something like this:

======================================================
#!/bin/sh

### Initialization
old_word="$1"
new_word="$2"

### error checking
test $# -eq 2 || { echo Usage: "% $0" oldWord newWord ; exit 1 ; }

### Main
/bin/ls | while read file
do  test -f $file || continue
    sed s/$1/$2/g  $file > ${file}.new
    mv ${file}.new ${file}
done
======================================================



Ioannis Tambouras
ioannis@flinet.com, West Palm Beach, Florida
Signed pgp-key on key server.

On Wed, 19 Feb 1997, Michael Meskes wrote:

> Do we have any tool to grep and substitute on multiple files? What I want to
> do is replace the name of an include file in each source file at once. Is
> there a way to do this?
>
> I know of one tool named fgres. If we do not have anything similar and
> nobody's working on it I consider packaging fgres.
>
> Michael
> --
> Michael Meskes, Projekt-Manager      | meskes@topsystem.de, meskes@debian.org
> topsystem Systemhaus GmbH            | Phone: (+49) 2405/4670-44
> Europark A2, Adenauerstr. 20         | Fax:   (+49) 2405/4670-10
> 52146 Wuerselen                      | Go SF 49ers! Use Debian GNU/Linux!
>
>
> --
> TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
> debian-devel-REQUEST@lists.debian.org . Trouble? e-mail to Bruce@Pixar.com
>
>

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv

iQCVAwUBMwrsufdPvfH6n4hRAQFCIQQArEF0fpm+4ijpZdEvvDpKTj+AemG4y6f+
bgmPyjxnfAQlTSbylpz2SboiiYq70DER3dccyXjppDC/yuhTdQ+ikRccZm69C0D9
b3Tq3F8SaEbdxAz03pG443HcOaU8IZYJCulVLkaebGhnIhAfVsQx6MEPAO4SB22f
0h3pBCoagSQ=
=pIZO
-----END PGP SIGNATURE-----


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-REQUEST@lists.debian.org . Trouble? e-mail to Bruce@Pixar.com


Reply to: