Trim right columns from text file

Old Fortran or COBOL programs may have columns 73-80 filled with vestigial card sequence numbers. Trim rightmost columns as in this example. This keeps the first 72 columns of text from “ancient.for” on each row, resaving as “ancient.f”.

cut -c-72 > ancient.f < ancient.for

Any trailing whitespace (up to 72 characters for this example) remains.


Related: remove leftmost columns from text file