U.S. Geological Survey

U.S. Geological Survey Global Change Research Program

TRANSPOS: A program to transpose tab-delimited text files

By Peter N. Schweitzer U.S. Geological Survey, Reston, VA 20192

Introduction

Since many of the data files available on the Global Change and Climate History Program's data server are stored as tables in tab-delimited text format, it may be useful to have some tools for manipulating these files apart from the spreadsheet and data base management systems for which they are intended. TRANSPOS is a program that transposes the rows and columns of a table in tab-delimited text format.

Usage

Name the input file on the command line. Output is directed to the standard output device, so users will typically want to redirect the output to a disk file.

Example:

transpos table1.txt >table2.txt
This example causes the file table2.txt to be created. It will contain the data from table1.txt with the rows and columns transposed.

Annotated list of included files

Note that the C source code was written with 4-space tab expansion (i.e. tab characters expand to 4 spaces, not 8 as old text editors often do). The assembly code (16-bit DOS only) uses 8-space tabs.
UNIX
transpos.c
Source code compatible with the UNIX system, but uses only Standard (i.e. ANSI) C function calls.
DOS
Source code compatible with the MS-DOS operating system
16-bit
For PC's with 80286 or lower 16-bit CPU chips.
transpos.c
Source code customized to compile using Turbo C 2.01 from Borland, International.
transpos.exe
Executable for 16-bit DOS.
far_read.asm
Assembly-language subroutine to read data from disk; like fread but destination is a far pointer. Assemble using Turbo Assembler 2.0 from Borland, International.
32-bit
For PC's running Microsoft Windows 95, 98, or NT
transpos.c
Source code (identical to UNIX version)
transpos.exe
Executable code compiled with gcc using Cygwin-32 installation

Technical contact

    Peter N. Schweitzer
    Mail Stop 918, National Center
    U.S. Geological Survey
    Reston, VA 20192

    Tel: (703) 648-6533
    FAX: (703) 648-6560
    email: pschweitzer@usgs.gov

This page is <http://geochange.er.usgs.gov/pub/tools/transpose/README.html>
Maintained by Peter Schweitzer
Last updated 30-Jul-1999