.\" Copyright (c) 1980, 1990, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)error.1 8.1 (Berkeley) 6/6/93 .\" jpman %Id: expand.1,v 1.2 1997/04/03 02:16:14 mutoh Stab % .\" .Dd June 6, 1993 .Dt EXPAND 1 .Os BSD 4 .Sh 名称 .Nm expand , .Nm unexpand .Nd タブと空白文字の変換 .Sh 書式 .Nm expand .Op Fl Ns Ar tabstop .Op Fl Ns Ar tab1,tab2,...,tabn .Ar .Nm unexpand .Op Fl a .Ar .Sh 解説 .Nm expand は、指定されたファイルまたは標準入力を読み込み、 タブを空白文字に変換して標準出力に出力します。 バックスペース文字はそのまま出力し、 同時にタブの計算に用いるカラム位置カウンタを一つ減じます。 .Nm expand は、 (ソートの前、特定のカラムに注目したいとき、など) タブを含んだテキストファイルの前処理用に便利です。 .Pp .\"(訳注) 原文では,以下のようなオプション列挙型の記述ではありませんが .\" 解りやすいと考えますので,私も前のバージョンの例にならいます. .\" 2.2.1R 対象(1997/04/03) Takeshi MUTOH オプションとしては以下のものがあります: .Bl -tag -width flag .It Fl t Ar tabstop タブ幅を指定します。デフォルトは 8 文字です。 .It Fl t Ar tab1,tab2,...,tabn 指定されたカラム位置にタブストップを設定します。 .El .Pp .Fl t のかわりに、 .Fl Ar tabstop もしくは .Fl Ar tab1, tab2,..., tabn という指定も許されます。 .Pp .Nm unexpand は、 .Nm expand とは逆に、空白文字をタブに戻します。デフォルトでは、 行頭の空白文字とタブだけを、できるだけ長いタブの並びに戻します。 .Pp オプションとしては以下のものがあります: .Bl -tag -width flag .It Fl a 行頭でなくても、二つ以上の空白文字が続いており、空白文字をタブに置き換えれば サイズが圧縮されるような箇所はすべてタブに置き換えられます。 .El .Sh 歴史 .Nm expand コマンドは .Bx 3.0 から登場しました。