It's not quite clear from your description and the example input, but I assume that the data columns are in lines 25 to 51. It looks as if the row of hyphens just above that indicates the columns. The first column starts with the first character of the line. (There is a similar table above that with four columns and one row, which is indented, which should probably be skipped.) The data rows are terminated by another row of hyphens.
So the basic algorithm is: Read everything up to the row of hyphens, store column widths and starting points for each field, then read the subsequent data, cut out the columns you want using the information from the hyphens and stop reading when you encounter the next line.
That's probably something a script can do easily for you. The standalone C program below does that, too. You can call it from the command line like that:
./colcut data.txt 3 5 1
to print out columns 3, 5 and 1 (natural count, not zero-based) of the file "data.txt". Error handling is probably lacking - it doesn't check whether the columns are long enough, for example - but it looks serviceable:
#include <stdlib.h>
#include <stdio.h>
#define die(x) do { \
fprintf(stderr, "Fatal: %s\n", x); \
exit(1); \
} while (0)
#define MAX 10
#define MAXLEN 500
typedef struct { /* Text slice into a char buffer */
const char *str; /* start pointer */
int len; /* slice length */
} Slice;
int main(int argc, char *argv[])
{
FILE *f;
int index[MAX]; /* column index */
int nindex = 0; /* number of columns to write */
Slice cols[MAX]; /* column substrings */
int context = 0; /* Are we scaning columns? */
int i;
if (argc < 3) die("Usage: col file columns ...");
for (i = 2; i < argc; i++) {
int n = atoi(argv[i]);
if (n < 1 || n > MAX) die("Illegal index");
index[nindex++] = n - 1;
}
f = fopen(argv[1], "r");
if (f == NULL) die("Could not open file.");
for (;;) {
char line[MAXLEN];
if (fgets(line, MAXLEN, f) == NULL) break;
if (context) {
if (line[0] == '-') break;
for (i = 0; i < nindex; i++) {
int j = index[i];
printf(" %.*s", cols[j].len, cols[j].str);
}
putchar(10);
}
if (line[0] == '-') {
const char *p = line;
int n = 0;
while (*p == '-' || *p == ' ') {
cols[n].str = p;
while (*p == '-') p++;
cols[n].len = p- cols[n].str;
while (*p == ' ') p++;
if (++n == MAX) break;
}
for (i = 0; i < nindex; i++) {
if (index[i] >= n) die("Columns index out of range");
}
context = 1;
}
}
fclose(f);
return 0;
}