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

Mail #13380

Back to main page of archive

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

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

Grant Jacobs wrote:

> 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

BTW, more is a pager. It will usually just write out the file when
used in a pipe, but that's kind of a misuse. Usually one would use
cat instead, or input redirection (sed < file), or simply an
argument (for sed, as sed accepts input file name arguments, i.e.
sed 's...' file).

> 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.

Looks right. BTW, if size limitations are a concern (i.e., rather
many files), then the find | xargs combination is often useful, as I
wrote in my other mail. xargs will group the arguments up to the
limits the system can handle and call the program (in my case, the
script) as often as necessary.

Frank

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


In reply to

Author Subject Date
The Chief Changing source code 8 Mar 2006, 10:29:08
Grant Jacobs Changing source code 9 Mar 2006, 00:05:58

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).