Trim right columns from text file

Related: remove left columns from text file


Old Fortran or COBOL programs may have columns 73-80 filled with vestigial card sequence numbers. Remove them or any other text more than N columns long by:

Trim right columns

This example 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.

Tags: ,

Categories:

Written by Michael Hirsch, Ph.D. //

Comments