English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have various text files containing code. Some of the code is in strings. I want to write a macro that will change this text:

code; code; code; function("string1"); code;
code; code; function("string1"); code; code;

into this text:

bigstring = "string1string2"
code; code; code; function(bigstring, start0, finish6); code;
code; code; function(bigstring, start7, finish13); code; code;

In other words, I need something that will open a file, find each example of a certain function, change it in the way I want, and then save the file and go onto the next one. Any suggestions?

2006-12-09 05:16:46 · 6 answers · asked by Chris T 1 in Computers & Internet Programming & Design

I should maybe explain that I am using a game authoring tool (Sludge), based on C++ but with a very limited set of commands. And the finished code has to be accepted by the tool's own compiler so I can't try anything too clever. Thanks for the suggestions so far - I am looking into them with great interest.

2006-12-09 05:48:58 · update #1

6 answers

I think you need something moder advance and dig into features, so my advice to you seeking for smart code editor keywords in google
I think you may like this http://www.filetransit.com/view.php?id=22359
I use to use fox-pro coder to do such things but i think no newer version.

2006-12-09 05:27:40 · answer #1 · answered by Labib 2 · 0 0

Lots of ways to do this. What language are you using? Every programming book has a chapter dedicated to solving File IO, text file access, how to create, delete, appended, a file, and how to read records from a file. Do a search for (Your programming language and macro text files)

2006-12-09 05:29:08 · answer #2 · answered by timmytude 4 · 0 0

I suggest the unix command-line tools (runs under cygwin on windows). They were written long ago to do just such work, by programmers, for programmers. grep/sed/awk work fine for the job, and will accomplish your task in about 10 lines. I have manipulated tons of C/C++ just as you describe using these tools, and there are plenty of tutorials online for them.

2006-12-09 05:23:00 · answer #3 · answered by WickedSmaht 3 · 0 0

If you want to getup and running really quick with very little overhead, Check out PERL. Perl is a great choice for what you want to do. You can easily learn perl in a day or two. Check out their website, they even have free books to learn perl.

2006-12-09 05:22:00 · answer #4 · answered by Big H 4 · 0 0

Hello i have a website which i can send you codes and links to websites for myspace the site is www.skatecomp.co.nr sign up on the forums

2006-12-09 06:51:40 · answer #5 · answered by Ryan 2 · 0 0

sed (Stream EDitor) used to be the tool of choice for something like this, but you'll probably want to use a perl script to do something like this now.

HTH-

2006-12-09 05:22:28 · answer #6 · answered by Steve A 2 · 0 0

fedest.com, questions and answers