GNU Pascal Homepage - gpc - gpc-announce - gpc-de - gpc-doc
Diese Seite auf deutsch

Mail #13379

Back to main page of archive

Previous mail   Next mail   Unformatted/full headers
Overview  10 days   Subject   Date   Thread   Author  

From: Grant Jacobs
Subject: Changing source code
Date: 9 Mar 2006, 00:05:58


If you're on Unix/Linux/OS X et al, you could use sed, e.g.

more file | sed 's|Type foo = Object (bar)|Type Tfoo = Class (Tbar)|' > newfile

You'll need to nest this in a loop.

In csh it'd be something like:

   foreach file (*.pas)
     ...
   end

I think in bash you'd be after:

   for file in *.pas
   do
     ...
   done

Hope this is enough to get you started -- good luck.

I have my own small script to deal with filename expansion which 
avoids shell limits on the number of parameters, etc., which is why I 
forget exactly how the filename expansion loop things work.


Grant

>Hi
>
>This isn't strictly a GPC question, but it is related, so I'll ask
>anyway :|
>
>Is there an easy way to change a string in all source files to another
>string?
>
>For example, if I want to change all occurrences of "Type foo = Object
>(bar)" to "Type Tfoo = Class (Tbar)" in all ".pas" and ".pp" files in a
>directory tree, is there an easy way to do it, using standard GNU
>tools? I could of course write a program to do it, but I figured there
>could be an easier way. Thanks.
>
>Best regards, The Chief
>--------
>Prof. Abimbola A. Olowofoyeku (The African Chief)
>web:  http://www.greatchief.plus.com/

Previous mail   Next mail   Unformatted/full headers
Overview  10 days   Subject   Date   Thread   Author  


Replies

Author Subject Date
Frank Heckenbach Changing source code 8 Mar 2006, 12:18:45

In reply to

Author Subject Date
The Chief Changing source code 8 Mar 2006, 10:29:08

Back to main page of archive


Note: This page contains information that does not originate from the owner of this web site, but from the authors of the mails archived. The owner of this web site is not responsible for the content of such information. Any use of that infomation requires the consent of the respective author.

Where WWW addresses (URLs) in the mails archived are marked as hyperlinks, this is only for the comfort of the reader. The content of the web pages linked to like this does not necessarily reflect the opinion of the owner of this web site or of the authors of the mails archived. The owner of this web site is not responsible for the content of such web pages. Those pages are explicitly not to be considered as part of the content of this page, but merely as references.


This page was created by Crystal 0.999 (Linux 2.4.27/i686).