REFORMAT is a FORTRAN90 program which reads an ASCII text file, and writes a copy, with the property that every line (except perhaps the last one) has the same number of values on it.
This program was "inspired" by a situation in which the data in a file was not arranged as expected.
It was assumed that there were 4 items in every line.
But in fact, a free format had been used, and the system "felt free" to write 3 values per line, resulting in a ragged file of lines of alternating lengths of 3 and 1.
One can easily imagine other cases where 11 values would be written as 3/3/3/2.
And if the system had used another limit for the number of values per line, we would find that L values had been written as M/M/M/M/N instead.
The purpose of this program is allow for the repair of these "mistakes" in the simplest case. Thus, we imagine the command
reformat ragged.txt smooth.txt 4
would read data from the file "ragged.txt", and write it out 4 words
at a time.
In my experience, it has always been the case that several lines of the ragged file always exactly equaled one line of the smooth file. But it is easy to imagine more complicated situations.
The reasonable thing to do, I think, is to interpret the command as an attempt to get ALL the information in the ragged file into the smooth file, using the fixed limit.
This decision means the program can also be used to take a file of four words per line and turn it into one of 3 words per line.
This version of the program is only able to deal with files that contain nothing but real numbers. For a version that works with abstract 'words', see REWORD below.
CRRM is an executable C++ program which reads a text file and writes a copy which has no carriage returns.
DEBLANK is an executable C++ program which reads a text file and writes a copy which has no blank lines.
DECOMMENT is an executable C++ program which makes a copy of a text file which contains no "comment" lines (that begin with "#").
FILUM is a library of FORTRAN90 routines for performing various operations on files.
REWORD is an executable C++ program which reads a text file and writes a copy which has a fixed number of "words" per line.
TABLE_COLUMNS is an executable FORTRAN90 program which will extract the data in certain columns of a file.
UNCONTROL is an executable C++ program which makes a copy of a text file which contains no control characters.
WRAP is an executable C++ program which makes a copy of a text file in which no line is longer than a user-specified wrap length.
WRAP2 is a C++ program which wraps long lines in a text file, but which wraps some lines "early", so as to avoid breaking words.
You can go up one level to the FORTRAN90 source codes.