📄 283-286.html
字号:
<HTML>
<HEAD>
<TITLE>Linux in Plain English:Linux Commands Organized by Group</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!--ISBN=1558285423//-->
<!--TITLE=Linux in Plain English//-->
<!--AUTHOR=Patrick Volkerding//-->
<!--AUTHOR=Kevin Reichard//-->
<!--PUBLISHER=IDG Books Worldwide, Inc.//-->
<!--IMPRINT=M & T Books//-->
<!--CHAPTER=5//-->
<!--PAGES=283-286//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="277-282.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="287-291.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<P><FONT SIZE="+1"><B>csplit......<TT>Split Files</TT></B></FONT></P>
<P><B>csplit</B> <I>option(s) file arguments</I></P>
<P><FONT SIZE="+1"><B><I>PURPOSE</I></B></FONT></P>
<P>The <B>csplit</B> command splits a long file into two or more smaller files. You can tell <B>csplit</B> to split files based on size or by content, using specific expressions as markers for splitting. The original file will be unchanged.</P>
<P>The new files will begin with <B>xx</B>. The first file is <B>xx00</B> (remember, Linux likes to begin everything with <I>0</I>), the next file is <B>xx01</B>, and so on. There’s a limit of 100 files, so the highest filename numerically is <B>xx99</B>.</P>
<P><FONT SIZE="+1"><B><I>OPTIONS</I></B></FONT></P>
<TABLE WIDTH="100%">
<TR>
<TD WIDTH="20%"><B>-f <I>txt</I></B>
<TD WIDTH="80%">Uses <I>txt</I> instead of <B>xx</B> to begin the new filenames.
<TR>
<TD><B>-k</B>
<TD>Keeps files even if the command line fails.
<TR>
<TD VALIGN="TOP"><B>-n <I>num</I></B>
<TD>Uses numbers that are <I>num</I> characters long in filenames, instead of two, the default.
<TR>
<TD><B>-q</B>
<TD>Suppresses character counts.
<TR>
<TD><B>-s</B>
<TD>Suppresses character counts.
<TR>
<TD><B>-z</B>
<TD>Doesn’t create empty files, but does maintain numbering.
</TABLE>
<P><FONT SIZE="+1"><B><I>ARGUMENTS</I></B></FONT></P>
<TABLE WIDTH="100%">
<TR>
<TD WIDTH="20%" VALIGN="TOP"><B><I>|expr|</I></B>
<TD WIDTH="80%">Creates a file that begins with a current line to the line containing <I>expr</I>. You can add a suffix that ends a file <I>num</I> lines before or after <I>expr</I>—either +<I>num</I> or <I>-num</I>.
<TR>
<TD VALIGN="TOP"><B>%<I>expr</I>%</B>
<TD>Creates a file that begins with <I>expr</I>. You can add a suffix that ends a file <I>num</I> lines before or after <I>expr</I>—either +<I>num</I> or <I>-num</I>.
<TR>
<TD><B><I>line</I></B>
<TD>Creates a file at the current line and ends one line before <I>line</I>.
<TR>
<TD VALIGN="TOP"><B><I>{n}</I></B>
<TD>Repeats an argument <I>n</I> number of lines. The default is to repeat an argument once.
</TABLE>
<P><FONT SIZE="+1"><B><I>EXAMPLE</I></B></FONT></P>
<!-- CODE SNIP //-->
<PRE>
$ csplit -k bonfire ‘/Chapter/’ {20}
</PRE>
<!-- END CODE SNIP //-->
<P>This splits a file named <B>bonfire</B> into 20 chapters, each beginning with <I>Chapter</I>.</P>
<P><FONT SIZE="+1"><B>cut......<TT>Cut Columns</TT></B></FONT></P>
<P><B>cut</B> <I>option(s) files</I></P>
<P><FONT SIZE="+1"><B><I>PURPOSE</I></B></FONT></P>
<P>The <B>cut</B> command cuts columns or fields from a file or set of files and displays them. You can use the information to view parts of a file, or else you can take the information and send it to another new file.</P>
<P><FONT SIZE="+1"><B><I>OPTIONS</I></B></FONT></P>
<TABLE WIDTH="100%">
<TR>
<TD WIDTH="25%"><B>-c <I>list</I></B>
<TD WIDTH="75%">Cuts columns specified in <I>list</I>.
<TR>
<TD VALIGN="TOP"><B>-d <I>character</I></B>
<TD>Specifies delimiter for determining columns or fields; the default is a tab. If a nonalphanumeric character is used (such as a space), then it must be enclosed in single quote marks. This option must be used with the <B>-f</B> option.
<TR>
<TD><B>-f <I>list</I></B>
<TD>Cuts fields specified in <I>list</I>.
<TR>
<TD VALIGN="TOP"><B>-s</B>
<TD>Suppresses lines without a delimiter; used with the <B>-f</B> option.
</TABLE>
<P><FONT SIZE="+1"><B><I>EXAMPLE</I></B></FONT></P>
<!-- CODE SNIP //-->
<PRE>
$ cut -f1,4 payroll
</PRE>
<!-- END CODE SNIP //-->
<P>This cuts the first and fourth fields from the file <B>payroll</B> and displays them on the screen.</P>
<!-- CODE SNIP //-->
<PRE>
$ cut -c1,4 payroll > payroll.old
</PRE>
<!-- END CODE SNIP //-->
<P>This cuts the first and fourth columns from the file <B>payroll</B> and places then in a new file entitled <B>payroll.old</B>.</P>
<P><FONT SIZE="+1"><B><I>RELATED COMMANDS</I></B></FONT></P>
<DL>
<DD><B>grep</B>
<DD><B>join</B>
<DD><B>paste</B>
</DL>
<P><FONT SIZE="+1"><B>diff......<TT>List Differences in Files</TT></B></FONT></P>
<P><B>diff</B> <I>option(s) diroptions file1 file2</I></P>
<P><FONT SIZE="+1"><B><I>PURPOSE</I></B></FONT></P>
<P>The <B>diff</B> command compares two files and returns the lines that differ. The line numbers of the differing files are marked with the < and > symbols: The differing line from <I>file1</I> is marked with < and the differing line from <I>file2</I> is marked with >. Three hyphens (---) separate the contents of the files.</P>
<P>The <B>diff</B> command can also be used to compare files in different directories. In this situation, use <B>diroptions</B>.</P>
<P>This command works best with smaller text files.</P>
<P><FONT SIZE="+1"><B><I>OPTIONS</I></B></FONT></P>
<TABLE WIDTH="100%">
<TR>
<TD WIDTH="20%"><B>-a</B>
<TD WIDTH="80%">Compares all files, including binary files.
<TR>
<TD><B>-b</B>
<TD>Ignores blanks at the end of a line.
<TR>
<TD><B>-B</B>
<TD>Ignores blank lines within the files.
<TR>
<TD><B>-c</B>
<TD>Prints three lines of context for each difference.
<TR>
<TD VALIGN="TOP"><B>-d</B>
<TD>Speeds processing by ignoring areas with many changes.
<TR>
<TD VALIGN="TOP"><B>-e</B>
<TD>Returns commands to recreate <I>file2</I> from <I>file1</I> using the <B>ed</B> text editor.
<TR>
<TD VALIGN="TOP"><B>-H</B>
<TD>Scans for scattered small changes; will miss out on many other changes.
<TR>
<TD><B>-i</B>
<TD>Ignores the case when comparing files.
<TR>
<TD><B>-I <I>expr</I></B>
<TD>Ignores file lines that match <I>expr</I>.
<TR>
<TD><B>-n</B>
<TD>Returns information in RCS <B>diff</B> format.
<TR>
<TD><B>-N</B>
<TD>Treats nonexistent files as empty.
<TR>
<TD><B>-t</B>
<TD>Expands tabs to spaces in output.
<TR>
<TD><B>-T</B>
<TD>Inserts tabs at the beginning of lines.
<TR>
<TD><B>-u</B>
<TD>Prints old and new versions of a file as a single line.
<TR>
<TD><B>-w</B>
<TD>Ignores tabs and spaces (white space).
<TR>
<TD><B>-y</B>
<TD>Returns information in two columns.
</TABLE>
<P><FONT SIZE="+1"><B><I>DIROPTIONS</I></B></FONT></P>
<TABLE WIDTH="100%">
<TR>
<TD WIDTH="20%"><B>-l</B>
<TD WIDTH="80%">Paginates the output to <B>pr</B>.
<TR>
<TD VALIGN="TOP"><B>-r</B>
<TD>Recursively runs <B>diff</B> to look at files in common subdirectories.
<TR>
<TD><B>-s</B>
<TD>Returns identical files.
<TR>
<TD VALIGN="TOP"><B>-S<I>file</I></B>
<TD>Begins with <I>file</I> when comparing directories, ignoring files alphabetically listed before <I>file</I>.
<TR>
<TD><B>-x <I>expr</I></B>
<TD>Ignores files that match <I>expr</I>; wildcards cannot be used.
<TR>
<TD><B>-X <I>filename</I></B>
<TD>Ignores files that match <I>expr</I>; wildcards can be used.
</TABLE>
<P><FONT SIZE="+1"><B><I>EXAMPLE</I></B></FONT></P>
<!-- CODE SNIP //-->
<PRE>
$ diff letter.1212 letter 1213
1c1
< December 12, 1997
- - -
> December 13, 1997
...
</PRE>
<!-- END CODE SNIP //-->
<P><FONT SIZE="+1"><B><I>RELATED COMMANDS</I></B></FONT></P>
<DL>
<DD><B>cmp</B>
<DD><B>diff3</B>
<DD><B>sdiff</B>
</DL>
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="277-282.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="287-291.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -