Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

text::tabs(3pm) [mojave man page]

Text::Tabs(3pm) 					 Perl Programmers Reference Guide					   Text::Tabs(3pm)

NAME
Text::Tabs - expand and unexpand tabs like unix expand(1) and unexpand(1) SYNOPSIS
use Text::Tabs; $tabstop = 4; # default = 8 @lines_without_tabs = expand(@lines_with_tabs); @lines_with_tabs = unexpand(@lines_without_tabs); DESCRIPTION
Text::Tabs does most of what the unix utilities expand(1) and unexpand(1) do. Given a line with tabs in it, "expand" replaces those tabs with the appropriate number of spaces. Given a line with or without tabs in it, "unexpand" adds tabs when it can save bytes by doing so, like the "unexpand -a" command. Unlike the old unix utilities, this module correctly accounts for any Unicode combining characters (such as diacriticals) that may occur in each line for both expansion and unexpansion. These are overstrike characters that do not increment the logical position. Make sure you have the appropriate Unicode settings enabled. EXPORTS
The following are exported: expand unexpand $tabstop The $tabstop variable controls how many column positions apart each tabstop is. The default is 8. Please note that "local($tabstop)" doesn't do the right thing and if you want to use "local" to override $tabstop, you need to use "local($Text::Tabs::tabstop)". EXAMPLE
#!perl # unexpand -a use Text::Tabs; while (<>) { print unexpand $_; } Instead of the shell's "expand" comand, use: perl -MText::Tabs -n -e 'print expand $_' Instead of the shell's "unexpand -a" command, use: perl -MText::Tabs -n -e 'print unexpand $_' SUBVERSION
This module comes in two flavors: one for modern perls (5.10 and above) and one for ancient obsolete perls. The version for modern perls has support for Unicode. The version for old perls does not. You can tell which version you have installed by looking at $Text::Tabs::SUBVERSION: it is "old" for obsolete perls and "modern" for current perls. This man page is for the version for modern perls and so that's probably what you've got. BUGS
Text::Tabs handles only tabs (" ") and combining characters ("/pM/"). It doesn't count backwards for backspaces (" "), omit other non- printing control characters ("/pC/"), or otherwise deal with any other zero-, half-, and full-width characters. LICENSE
Copyright (C) 1996-2002,2005,2006 David Muir Sharnoff. Copyright (C) 2005 Aristotle Pagaltzis Copyright (C) 2012 Google, Inc. This module may be modified, used, copied, and redistributed at your own risk. Publicly redistributed modified versions must use a different name. perl v5.18.2 2014-01-06 Text::Tabs(3pm)

Check Out this Related Man Page

expand(1)							   User Commands							 expand(1)

NAME
expand, unexpand - expand TAB characters to SPACE characters, and vice versa SYNOPSIS
expand [-t tablist] [file]... expand [-tabstop] [-tab1, tab2,. . ., tabn] [file]... unexpand [-a] [-t tablist] [file]... DESCRIPTION
The expand utility copies files (or the standard input) to the standard output, with TAB characters expanded to SPACE characters. BACKSPACE characters are preserved into the output and decrement the column count for TAB calculations. expand is useful for pre-processing character files (before sorting, looking at specific columns, and so forth) that contain TAB characters. unexpand copies files (or the standard input) to the standard output, putting TAB characters back into the data. By default, only leading SPACE and TAB characters are converted to strings of tabs, but this can be overridden by the -a option (see the OPTIONS section below). OPTIONS
The following options are supported for expand: -t tablist Specifies the tab stops. The argument tablist must consist of a single positive decimal integer or multiple posi- tive decimal integers, separated by blank characters or commas, in ascending order. If a single number is given, tabs will be set tablist column positions apart instead of the default 8. If multiple numbers are given, the tabs will be set at those specific column positions. Each tab-stop position N must be an integer value greater than zero, and the list must be in strictly ascending order. This is taken to mean that, from the start of a line of output, tabbing to position N causes the next character output to be in the (N+1)th column position on that line. In the event of expand having to process a tab character at a position beyond the last of those specified in a multiple tab-stop list, the tab character is replaced by a single space character in the output. -tabstop Specifies as a single argument, sets TAB characters tabstop SPACE characters apart instead of the default 8. -tab1,tab2,...,tabn Sets TAB characters at the columns specified by -tab1,tab2,...,tabn The following options are supported for unexpand: -a Inserts TAB characters when replacing a run of two or more SPACE characters would produce a smaller output file. -t tablist Specifies the tab stops. The option-argument tablist must be a single argument consisting of a single positive decimal inte- ger or multiple positive decimal integers, separated by blank characters or commas, in ascending order. If a single number is given, tabs will be set tablist column positions apart instead of the default 8. If multiple numbers are given, the tabs will be set at those specific column positions. Each tab-stop position N must be an integer value greater than zero, and the list must be in strictly ascending order. This is taken to mean that, from the start of a line of output, tabbing to posi- tion N will cause the next character output to be in the (N+1)th column position on that line. When the -t option is not specified, the default is the equivalent of specifying -t 8 (except for the interaction with -a, described below). No space-to-tab character conversions occur for characters at positions beyond the last of those specified in a multiple tab-stop list. When -t is specified, the presence or absence of the -a option is ignored; conversion will not be limited to the processing of leading blank characters. OPERANDS
The following ooperand is supported for expand and unexpand: file The path name of a text file to be used as input. ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of expand and unexpand: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH. EXIT STATUS
The following exit values are returned: 0 Successful completion >0 An error occurred. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWesu | +-----------------------------+-----------------------------+ |CSI |enabled | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
tabs(1), attributes(5), environ(5), standards(5) SunOS 5.11 1 Feb 1995 expand(1)
Man Page