LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-06-2006, 07:50 AM   #1
Zmyrgel
Senior Member
 
Registered: Dec 2005
Location: Finland
Distribution: Slackware, CentOS, RHEL, OpenBSD
Posts: 1,006

Rep: Reputation: 37
Renaming


Hi,

I need aid in renaming. I'm translating my c++ projects files and code itself in english and I'm seeking now a good way to change references and variables to english.

I have 20 files. 9 *.cpp and 9 *.hpp files and I need to change for example all references to the old "Myyja.cpp" to "seller.cpp" inside all the 20 files.

How can this be done?
 
Old 08-06-2006, 07:59 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400
Hi,

Yes, you can do this:

find . -name "*cpp" -exec sed -i 's/Myyja.cpp/seller.cpp/g' {} \;

The above example looks for all files ending with cpp in the current dir and above, gives them to sed, which changes the text accordingly. The find statement can be tuned to include/exclude other files.

PS: Sed's -i option only works in sed version 4+

Hope this helps.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Renaming files TomalakBORG Linux - Newbie 2 12-05-2005 04:13 PM
Help with renaming machine MbowerARA Linux - General 5 07-29-2005 05:23 PM
Renaming ~/GNUstep Draknek Linux - Software 3 09-12-2004 05:56 AM
Renaming of Root id RajaRC Linux - Security 1 08-30-2004 06:04 AM
renaming to lowercase locazor Linux - Software 1 01-02-2004 08:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration