trcol (1) Delete or Translate columns of a file (Apr 2005)
The cols selection has the form start[–end[,...]], start and end being the starting and ending column of a field. For instance, colums 1, 3 to 5, and beyond 80 (81 or more) are written 1,3-5,81-. The complete line is written 1-
Note that trcol cannot exchange columns nor insert text; see acut(1) for such facilities.
The options allow to specify whether we wish to delete or translate columns.
–acols asks to transform to lowercase the specified columns.
–Acols asks to transform to uppercase the specified columns.
–bcols asks to delete with blank test the specified columns. Non-blank columns are deleted, but a warning message is issued for each non-blank character which was removed. The returned status is the number of non-blank deleted characters.
–Bcols is similar to the -b option, but no warning message is issued; just the number of deleted non-blank characters is returned as a status.
–dcols asks to delete the specified columns without any test.
–lcols asks to left-justify the specified columns – blanks existing at the left are moved to the right.
–rcols asks to right-justify the specified columns – blanks existing at the right are moved to the left.
–scols asks to squeeze blanks in the specified columns: blanks existing at the left are mobed to the right, and multiple blanks are converted into a single blank.
–tcols s1 s2 asks to translate in the columns defined by cols characters from s1 into the corresponding characters of s2 (byte-per-byte translation). Strings s1 and s2 must have the same length. The dash (-) may be used to specify intervals, e.g. a-z for the 26 lowercase letters. Non-printable characters can be specified using the C conventions.
file is the name of one or several (concatenated) input files. stdin is the default input file.
trcol -b2-5 -t6 ' ' '0' -t73- 'A-Z' 'a-z'