[Top][All Lists]

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

Re: Change a keyword for another keyword

From: Mark E. Hamilton
Subject: Re: Change a keyword for another keyword
Date: Wed, 09 Feb 2005 09:35:25 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113

Jim.Hyslop wrote:
Paola Attadio wrote:

I need the change a keyword for another keyword in the archives a module of cvs. Quisiera to do this of once. Somebody knows some tool and/or way to do this?

Off the top of my head, something like:

find -type f -exec sed -i 's/\$OriginalRCSKeyword[^\$]*/$NewRCSKeyword/g' {}

should do it. Check your changes very carefully before committing, though,
in case one of the files is binary, or otherwise happens to have a string
that matches the keyword. You'll also probably want a way to filter out
files in the CVS subdirectories - I haven't figured out how to do that with
'find' yet (if indeed it's possible).

find <dir> -name CVS -prune -o -type f -exec sed ...

Note that you must specify the directory (or directories) to search before the expression options. Also, not all sed() implementations have the '-i (--in-place)' option. (I've used sed for years, and didn't know about it until just now. Gotta read those man pages more frequently. ;) )

Mark E. Hamilton
Orion International Technologies, Inc.
Sandia National Laboratory, NM.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]