📄 287-291.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=287-291//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="283-286.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="292-297.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<P><FONT SIZE="+1"><B>diff3......<TT>List Differences in Files</TT></B></FONT></P>
<P><B>diff3</B> <I>option(s) file1 file2 file3</I></P>
<P><FONT SIZE="+1"><B><I>PURPOSE</I></B></FONT></P>
<P>The <B>diff3</B> command compares three files and returns the differences between them, as with <B>diff</B>, but does not automatically return the differences. Instead, one of the following codes is returned:</P>
<TABLE WIDTH="100%"><TR>
<TD WIDTH="20%"><B>====</B>
<TD WIDTH="80%">All three files differ.
<TR>
<TD><B>====1</B>
<TD><I>file1</I> is different.
<TR>
<TD><B>====2</B>
<TD><I>file2</I> is different.
<TR>
<TD><B>====3</B>
<TD><I>file3</I> is different.
</TABLE>
<P><FONT SIZE="+1"><B><I>OPTIONS</I></B></FONT></P>
<TABLE WIDTH="100%">
<TR>
<TD WIDTH="20%" VALIGN="TOP"><B>-a</B>
<TD WIDTH="80%">Treats all files as text; useful for determining if there are differences between binary files.
<TR>
<TD VALIGN="TOP"><B>-A</B>
<TD>Creates an <B>ed</B> script that shows all differences between the files in brackets.
<TR>
<TD VALIGN="TOP"><B>-e</B>
<TD>Creates an <B>ed</B> script that places differences between <I>file2</I> and <I>file3</I> into <I>file1</I>.
<TR>
<TD VALIGN="TOP"><B>-E</B>
<TD>Creates an <B>ed</B> script that incorporates unmerged changes, delineated by brackets.
<TR>
<TD VALIGN="TOP"><B>-i</B>
<TD>Adds the <B>w</B> (save) and <B>q</B> (quit) commands to the end of <B>ed</B> scripts.
<TR>
<TD><B>-L <I>name</I></B>
<TD>Uses <I>name</I> instead of the filename in the output.
<TR>
<TD VALIGN="TOP"><B>-m</B>
<TD>Creates a new file with the changes merged; this is done directly and not with an <B>ed</B> script.
<TR>
<TD VALIGN="TOP"><B>-T</B>
<TD>Inserts a tab at the beginning of each line of differences, instead of the default two spaces.
<TR>
<TD VALIGN="TOP"><B>-x</B>
<TD>Creates an <B>ed</B> script that places all differences in the files in <I>file1</I>.
<TR>
<TD VALIGN="TOP"><B>-X</B>
<TD>Creates an <B>ed</B> script that places all differences in the files in <I>file1</I>. This is same as <B>-x</B>, except that the differences are surrounded by brackets.
<TR>
<TD VALIGN="TOP"><B>-3</B>
<TD>Creates an <B>ed</B> script that places differences between <I>file1</I> and <I>file3</I> into <I>file1</I>.
</TABLE>
<P><FONT SIZE="+1"><B><I>RELATED COMMANDS</I></B></FONT></P>
<DL>
<DD><B>cmp</B>
<DD><B>diff</B>
<DD><B>sdiff</B>
</DL>
<P><FONT SIZE="+1"><B>egrep......<TT>Search Files</TT></B></FONT></P>
<P><B>egrep</B> <I>option(s) pattern file(s)</I></P>
<P><FONT SIZE="+1"><B><I>PURPOSE</I></B></FONT></P>
<P>The <B>egrep</B> command searches files for text (referred to as <I>patterns</I> or <I>expressions</I>) in multiple files or a single file. It is a cousin to the <B>fgrep</B> and <B>grep</B> commands and usually is considered the most powerful and fastest of the three. However, it doesn’t support all ASCII characters—it will search for +, |, (, ), and ? as long as they are surrounded by quotation marks, but it will not search for patterns beginning with \.</P>
<P><FONT SIZE="+1"><B><I>OPTIONS</I></B></FONT></P>
<TABLE WIDTH="100%">
<TR>
<TD WIDTH="20%"><B>-A <I>num</I></B>
<TD WIDTH="80%">Displays <I>num</I> of lines after the matched pattern.
<TR>
<TD><B>-B <I>num</I></B>
<TD>Displays <I>num</I> of lines before the matched pattern.
<TR>
<TD><B>-b</B>
<TD>Returns the block number of the matched line.
<TR>
<TD VALIGN="TOP"><B>-c</B>
<TD>Returns the number of matches without listing the actual matches.
<TR>
<TD><B>-C</B>
<TD>Displays two lines before and after the matched pattern.
<TR>
<TD VALIGN="TOP"><B>-e <I>pattern</I></B>
<TD>Searches for <I>pattern</I> when <I>pattern</I> begins with a hyphen (-).
<TR>
<TD><B>-f <I>file</I></B>
<TD>Uses a <I>pattern</I> from <I>file</I>.
<TR>
<TD VALIGN="TOP"><B>-h</B>
<TD>Lists lines with matches without listing the files that contain them.
<TR>
<TD><B>-i</B>
<TD>Ignores case when matching.
<TR>
<TD VALIGN="TOP"><B>-l</B>
<TD>Lists files with matches without listing the actual matches.
<TR>
<TD><B>-L</B>
<TD>Lists files that don’t contain matching lines.
<TR>
<TD><B>-n</B>
<TD>Lists matched lines and their line numbers.
<TR>
<TD VALIGN="TOP"><B>-s</B>
<TD>Suppresses error messages about files that can’t be read or accessed.
<TR>
<TD><B>-v</B>
<TD>Lists lines that do not match the pattern.x
<TR>
<TD><B>-w</B>
<TD>Lists only whole words that are matched.
<TR>
<TD><B>-x</B>
<TD>Lists only whole lines that are matched.
</TABLE>
<P><FONT SIZE="+1"><B><I>EXAMPLES</I></B></FONT></P>
<!-- CODE SNIP //-->
<PRE>
$ egrep “Cogswell Cogs|Spacely Sprockets” *
</PRE>
<!-- END CODE SNIP //-->
<P>This searches the current directory—as noted with <SUB>*</SUB>—for the strings <I>Cogswell Cogs</I> and <I>Spacely Sprockets</I>.</P>
<P><FONT SIZE="+1"><B><I>RELATED COMMANDS</I></B></FONT></P>
<DL>
<DD><B>grep</B>
<DD><B>fgrep</B>
</DL>
<P><FONT SIZE="+1"><B>elvis......<TT>Text Editor</TT></B></FONT></P>
<P><B>elvis</B> <I>option(s) filename</I></P>
<P><FONT SIZE="+1"><B><I>PURPOSE</I></B></FONT></P>
<P>The <B>elvis</B> command launches a text editor. It’s a clone of the popular <B>vi</B> text editor; on Linux systems, if you use <B>vi</B> on a command line, you’ll really be invoking the <B>elvis</B> text editor. It responds to all the standard <B>vi</B> commands.</P>
<P><FONT SIZE="+1"><B><I>OPTIONS</I></B></FONT></P>
<TABLE WIDTH="100%">
<TR>
<TD WIDTH="20%"><B>-r</B>
<TD WIDTH="80%">Invokes the <B>elvrec</B> command to recover files.
<TR>
<TD><B>-R</B>
<TD>Opens a file in read-only status.
<TR>
<TD VALIGN="TOP"><B>-s</B>
<TD>Works in safe mode, so neophytes can’t do too much damage to files or a system.
<TR>
<TD><B>-t <I>tag</I></B>
<TD>Opens the file with <I>tag</I> as the first line.
<TR>
<TD VALIGN="TOP"><B>-m <I>file</I></B>
<TD>Searches through <I>file</I> for an error message from a compiler.
<TR>
<TD VALIGN="TOP"><B>-e</B>
<TD>Starts in colon command mode, similar to the UNIX <B>ex</B> command.
<TR>
<TD VALIGN="TOP"><B>-v</B>
<TD>Starts in visual command mode, similar to the UNIX <B>vi</B> command.
</TABLE>
<P><FONT SIZE="+1"><B><I>RELATED COMMANDS</I></B></FONT></P>
<DL>
<DD><B>elvrec</B>
<DD><B>emacs</B>
<DD><B>vi</B>
</DL>
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="283-286.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="292-297.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 + -