1 EXPAND(1) User Commands EXPAND(1) 2 3 4 5 NAME 6 expand, unexpand - expand TAB characters to SPACE characters, and vice 7 versa 8 9 SYNOPSIS 10 expand [-t tablist] [file]... 11 12 13 expand [-tabstop] [-tab1, tab2,. . ., tabn] [file]... 14 15 16 unexpand [-a] [-t tablist] [file]... 17 18 19 DESCRIPTION 20 The expand utility copies files (or the standard input) to the standard 21 output, with TAB characters expanded to SPACE characters. BACKSPACE 22 characters are preserved into the output and decrement the column count 23 for TAB calculations. expand is useful for pre-processing character 24 files (before sorting, looking at specific columns, and so forth) that 25 contain TAB characters. 26 27 28 unexpand copies files (or the standard input) to the standard output, 29 putting TAB characters back into the data. By default, only leading 30 SPACE and TAB characters are converted to strings of tabs, but this can 31 be overridden by the -a option (see the OPTIONS section below). 32 33 OPTIONS 34 The following options are supported for expand: 35 36 -t tablist 37 Specifies the tab stops. The argument tablist 38 must consist of a single positive decimal 39 integer or multiple positive decimal 40 integers, separated by blank characters or 41 commas, in ascending order. If a single 42 number is given, tabs will be set tablist 43 column positions apart instead of the default 44 8. If multiple numbers are given, the tabs 45 will be set at those specific column 46 positions. 47 48 Each tab-stop position N must be an integer 49 value greater than zero, and the list must be 50 in strictly ascending order. This is taken to 51 mean that, from the start of a line of 52 output, tabbing to position N causes the next 53 character output to be in the (N+1)th column 54 position on that line. 55 56 In the event of expand having to process a 57 tab character at a position beyond the last 58 of those specified in a multiple tab-stop 59 list, the tab character is replaced by a 60 single space character in the output. 61 62 63 -tabstop 64 Specifies as a single argument, sets TAB 65 characters tabstop SPACE characters apart 66 instead of the default 8. 67 68 69 -tab1,tab2,...,tabn 70 Sets TAB characters at the columns specified 71 by -tab1,tab2,...,tabn 72 73 74 75 The following options are supported for unexpand: 76 77 -a 78 Inserts TAB characters when replacing a run of two or 79 more SPACE characters would produce a smaller output 80 file. 81 82 83 -t tablist 84 Specifies the tab stops. The option-argument tablist 85 must be a single argument consisting of a single 86 positive decimal integer or multiple positive decimal 87 integers, separated by blank characters or commas, in 88 ascending order. If a single number is given, tabs will 89 be set tablist column positions apart instead of the 90 default 8. If multiple numbers are given, the tabs will 91 be set at those specific column positions. Each tab-stop 92 position N must be an integer value greater than zero, 93 and the list must be in strictly ascending order. This 94 is taken to mean that, from the start of a line of 95 output, tabbing to position N will cause the next 96 character output to be in the (N+1)th column position on 97 that line. When the -t option is not specified, the 98 default is the equivalent of specifying -t 8 (except for 99 the interaction with -a, described below). 100 101 No space-to-tab character conversions occur for 102 characters at positions beyond the last of those 103 specified in a multiple tab-stop list. 104 105 When -t is specified, the presence or absence of the -a 106 option is ignored; conversion will not be limited to the 107 processing of leading blank characters. 108 109 110 OPERANDS 111 The following operand is supported for expand and unexpand: 112 113 file 114 The path name of a text file to be used as input. 115 116 117 ENVIRONMENT VARIABLES 118 See environ(5) for descriptions of the following environment variables 119 that affect the execution of expand and unexpand: LANG, LC_ALL, 120 LC_CTYPE, LC_MESSAGES, and NLSPATH. 121 122 EXIT STATUS 123 The following exit values are returned: 124 125 0 126 Successful completion 127 128 129 >0 130 An error occurred. 131 132 133 ATTRIBUTES 134 See attributes(5) for descriptions of the following attributes: 135 136 137 138 139 +--------------------+-----------------+ 140 | ATTRIBUTE TYPE | ATTRIBUTE VALUE | 141 +--------------------+-----------------+ 142 |CSI | enabled | 143 +--------------------+-----------------+ 144 |Interface Stability | Standard | 145 +--------------------+-----------------+ 146 147 SEE ALSO 148 tabs(1), attributes(5), environ(5), standards(5) 149 150 151 152 February 1, 1995 EXPAND(1)