<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
I know that several of you are working on code and working on splitting
up code.&nbsp; Here is something I have used before from the UNIX POWER
TOOLS for breaking up C code into individual source files.<br>
<br>
example, adapted from AT&amp;T's UNIX <em class="emphasis">
User's Reference Manual</em>
:
<p class="para"></p>
<blockquote class="screen">
  <pre class="screen">% <code class="userinput">
<b>
csplit -s -k -f routine. prog.c '%main(%' '/^}/+1' '{99}'</b>
</code>
  </pre>
</blockquote>
<p class="para">
The idea is that the file <em class="emphasis">
prog.c</em> contains a group of C routines, and we want to place each
one in a separate file (<em class="emphasis">
routine.00</em>
, <em class="emphasis">
routine.01</em>
, etc.). The first pattern uses <code class="literal">
%</code> because we want to discard anything before <em
 class="emphasis">
main</em>
. The next argument says, "Look for a closing brace at the beginning of
a line (the conventional end of a routine) and split on the following
line (the assumed beginning of the next routine)." Repeat this split up
to 99 times, using <em class="emphasis">
-k</em> to preserve the created files. [4]</p>
<blockquote class="footnote">
  <p class="para">[4] In this case, the repeat can actually occur only
98 times, since we've already specified two arguments and the maximum
number is 100.</p>
</blockquote>
If you want to do Fortran, then there is a program called fsplit that I
have installed on zeus.&nbsp; (type man fsplit)<br>
<br>
<pre class="moz-signature" cols="72">-- 
Andrew J. Pounds, Ph.D.  (<a class="moz-txt-link-abbreviated" href="mailto:pounds@theochem.mercer.edu">pounds@theochem.mercer.edu</a>)
Associate Professor of Chemistry and Computer Science
Mercer University,  Macon, GA 31207   (478) 301-5627
</pre>
</body>
</html>