⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch24_06.htm

📁 the unix power tools
💻 HTM
字号:
<HTML><!--Distributed by F --><HEAD><TITLE>[Chapter 24] 24.6 Save Space with Tab Characters </TITLE><METANAME="DC.title"CONTENT="UNIX Power Tools"><METANAME="DC.creator"CONTENT="Jerry Peek, Tim O'Reilly &amp; Mike Loukides"><METANAME="DC.publisher"CONTENT="O'Reilly &amp; Associates, Inc."><METANAME="DC.date"CONTENT="1998-08-04T21:41:31Z"><METANAME="DC.type"CONTENT="Text.Monograph"><METANAME="DC.format"CONTENT="text/html"SCHEME="MIME"><METANAME="DC.source"CONTENT="1-56592-260-3"SCHEME="ISBN"><METANAME="DC.language"CONTENT="en-US"><METANAME="generator"CONTENT="Jade 1.1/O'Reilly DocBook 3.0 to HTML 4.0"><LINKREV="made"HREF="mailto:online-books@oreilly.com"TITLE="Online Books Comments"><LINKREL="up"HREF="ch24_01.htm"TITLE="24. Other Ways to Get Disk Space"><LINKREL="prev"HREF="ch24_05.htm"TITLE="24.5 Limiting File Sizes "><LINKREL="next"HREF="ch24_07.htm"TITLE="24.7 Compressing Files to Save Space "></HEAD><BODYBGCOLOR="#FFFFFF"TEXT="#000000"><DIVCLASS="htmlnav"><H1><IMGSRC="gifs/smbanner.gif"ALT="UNIX Power Tools"USEMAP="#srchmap"BORDER="0"></H1><MAPNAME="srchmap"><AREASHAPE="RECT"COORDS="0,0,466,58"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="467,0,514,18"HREF="jobjects/fsearch.htm"ALT="Search this book"></MAP><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch24_05.htm"TITLE="24.5 Limiting File Sizes "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 24.5 Limiting File Sizes "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><B><FONTFACE="ARIEL,HELVETICA,HELV,SANSERIF"SIZE="-1">Chapter 24<BR>Other Ways to Get Disk Space</FONT></B></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch24_07.htm"TITLE="24.7 Compressing Files to Save Space "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 24.7 Compressing Files to Save Space "BORDER="0"></A></TD></TR></TABLE>&nbsp;<HRALIGN="LEFT"WIDTH="515"TITLE="footer"></DIV><DIVCLASS="SECT1"><H2CLASS="sect1"><ACLASS="title"NAME="UPT-ART-9905">24.6 Save Space with Tab Characters </A></H2><TABLECLASS="para.programreference"BORDER="1"><TR><THVALIGN="TOP"><ACLASS="programreference"HREF="examples/index.htm"TITLE="unexpand">unexpand</A><BR></TH><TDVALIGN="TOP"><ACLASS="indexterm"NAME="AUTOID-26378"></A><ACLASS="indexterm"NAME="AUTOID-26381"></A><ACLASS="indexterm"NAME="AUTOID-26384"></A><ACLASS="indexterm"NAME="AUTOID-26386"></A><ACLASS="indexterm"NAME="AUTOID-26390"></A>The<SPANCLASS="link"><EMCLASS="emphasis">gzip</EM> (<ACLASS="linkend"HREF="ch24_07.htm"TITLE="Compressing Files to Save Space ">24.7</A>)</SPAN>utility, and other utilities like <EMCLASS="emphasis">compress</EM>, save space bysqueezing text into a form that you can't read without uncompressing.If a file has lots of spaces in it&nbsp;- for example, columns with lots ofspace between them, or lines that are indented&nbsp;- you may be able to savespace and keep the file readable too.<ACLASS="indexterm"NAME="AUTOID-26396"></A>Do that by changing the spaces to TAB characters with <EMCLASS="emphasis">unexpand</EM>.If it's not on your system, get it from the CD-ROM.</TD></TR></TABLE><PCLASS="para">How does it work?Article<ACLASS="xref"HREF="ch41_04.htm"TITLE="How UNIX Handles TAB Characters ">41.4</A>introduces TAB handling on UNIX.Each TAB character can replace as many as eight space characters.By default, <EMCLASS="emphasis">unexpand</EM> only changes spaces to TABs at the leftmargin.With the <EMCLASS="emphasis">-a</EM> option, it changes spaces wherever it can (withoutchanging the column positions of any text, of course).Comparing <EMCLASS="emphasis">ls&nbsp;-l</EM> listings of a file before and after<EMCLASS="emphasis">unexpand</EM>ing will tell you how muchyou've saved; the amount will vary file by file.</P><PCLASS="para">There are a few gotchas:</P><ULCLASS="itemizedlist"><LICLASS="listitem"><PCLASS="para">Your screen might not have tabstops every eight characters, so use<EMCLASS="emphasis">cat</EM> to send an <EMCLASS="emphasis">unexpand</EM>ed file to your screen;be sure the file looks the same as it did when it had spaces.</P></LI><LICLASS="listitem"><PCLASS="para">If you're sending the file to someone else, that person may havescreen problems too.You might want to<SPANCLASS="link"><EMCLASS="emphasis">expand</EM> (<ACLASS="linkend"HREF="ch41_04.htm"TITLE="How UNIX Handles TAB Characters ">41.4</A>)</SPAN>the TABs before you send the file.</P></LI><LICLASS="listitem"><PCLASS="para">Editing a file with TABs can be tough.Just <EMCLASS="emphasis">expand</EM> before editing and <EMCLASS="emphasis">unexpand</EM> when you're done.</P></LI></UL><DIVCLASS="sect1info"><PCLASS="SECT1INFO">- <SPANCLASS="authorinitials">JP</SPAN></P></DIV></DIV><DIVCLASS="htmlnav"><P></P><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch24_05.htm"TITLE="24.5 Limiting File Sizes "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 24.5 Limiting File Sizes "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="book"HREF="index.htm"TITLE="UNIX Power Tools"><IMGSRC="gifs/txthome.gif"SRC="gifs/txthome.gif"ALT="UNIX Power Tools"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch24_07.htm"TITLE="24.7 Compressing Files to Save Space "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 24.7 Compressing Files to Save Space "BORDER="0"></A></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172">24.5 Limiting File Sizes </TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="index"HREF="index/idx_0.htm"TITLE="Book Index"><IMGSRC="gifs/index.gif"SRC="gifs/index.gif"ALT="Book Index"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172">24.7 Compressing Files to Save Space </TD></TR></TABLE><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><IMGSRC="gifs/smnavbar.gif"SRC="gifs/smnavbar.gif"USEMAP="#map"BORDER="0"ALT="The UNIX CD Bookshelf Navigation"><MAPNAME="map"><AREASHAPE="RECT"COORDS="0,0,73,21"HREF="../index.htm"ALT="The UNIX CD Bookshelf"><AREASHAPE="RECT"COORDS="74,0,163,21"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="164,0,257,21"HREF="../unixnut/index.htm"ALT="UNIX in a Nutshell"><AREASHAPE="RECT"COORDS="258,0,321,21"HREF="../vi/index.htm"ALT="Learning the vi Editor"><AREASHAPE="RECT"COORDS="322,0,378,21"HREF="../sedawk/index.htm"ALT="sed &amp; awk"><AREASHAPE="RECT"COORDS="379,0,438,21"HREF="../ksh/index.htm"ALT="Learning the Korn Shell"><AREASHAPE="RECT"COORDS="439,0,514,21"HREF="../lrnunix/index.htm"ALT="Learning the UNIX Operating System"></MAP></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -