kailanhw@aludra.usc.edu (K. Luke Hwang) (05/14/89)
Hello, I need some help. I have a files which format to be 66 lines per page. Now I need to change it to 60 lines per page. So I have to delete last 6 lines of each pages. Is there a fast way to do it? Thanks. Newsgroups: la.general,usc.general Subject: Apartment to share Expires: May 31th References:
bph@buengc.BU.EDU (Blair P. Houghton) (05/15/89)
In article <3801@merlin.usc.edu> kailanhw@aludra.usc.edu () writes: >Hello, I need some help. >I have a files which format to be 66 lines per page. >Now I need to change it to 60 lines per page. >So I have to delete last 6 lines of each pages. I'm going to assume you are speaking precisely in that sentence. I'm going to give you a C program that merely lops off the last six lines, rather than reformatting from 66-line pages to 60-line pages with one- inch top and bottom margins. >Is there a fast way to do it? If there's a way faster than this, you've a better compiler than I, Gunga Din: /*-------------------------Rip Gently---------------------------------*/ /* 66260.c -- the program that podectomizes your pages. * * Copyright? You gotta be kidding...it's a four-cent * * program at best. Let the public domain have this * * one forever. Written By Blair P. Houghton in 1989. */ /* Well, not forever, it's not got function prototypes, so * * it isn't ANSI... */ #include <stdio.h> extern char *gets(); extern int puts(); /* No arguments. It reads stdin and writes stdout. */ main() { int lineno=0; char line[80]; /* One statement. No sweat. The sed * * script is a novella in comparison. */ while( gets(line) != NULL ) if ( ++lineno < 61 ) puts(line); else if ( lineno == 66 ) lineno = 0; } /*--------------------------End of Program------------------------*/ /* --Blair * "It took longer to get it * included in this posting..." */