old-www/LDP/GNU-Linux-Tools-Summary/html/x6823.htm

464 lines
6.2 KiB
HTML

<HTML
><HEAD
><TITLE
>Text Information Tools</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="GNU/Linux Command-Line Tools Summary"
HREF="book1.htm"><LINK
REL="UP"
TITLE="Text Related Tools"
HREF="c6435.htm"><LINK
REL="PREVIOUS"
TITLE="Text Viewing Tools "
HREF="x6546.htm"><LINK
REL="NEXT"
TITLE="Text manipulation tools"
HREF="x6993.htm"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>GNU/Linux Command-Line Tools Summary</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x6546.htm"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 11. Text Related Tools</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x6993.htm"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="TEXT-INFORMATION-TOOLS"
></A
>Text Information Tools</H1
><P
></P
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>wc</DT
><DD
><P
><A
NAME="AEN6831"
></A
>Word count, count how many words you have in a text <A
NAME="AEN6833"
></A
>document. Can also be used to count <A
NAME="AEN6835"
></A
>the lines or bytes <A
NAME="AEN6837"
></A
>within the file. </P
><P
>Use the options<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
> -w <A
NAME="AEN6841"
></A
></I
></SPAN
>for words, <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-l<A
NAME="AEN6844"
></A
> </I
></SPAN
>for lines <A
NAME="AEN6846"
></A
>and <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-c<A
NAME="AEN6849"
></A
> </I
></SPAN
>for bytes.<A
NAME="AEN6851"
></A
> Or simply run <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>wc</I
></SPAN
> with no options to get all three.</P
><P
>Command syntax:</P
><PRE
CLASS="SCREEN"
>wc -option file.txt</PRE
></DD
><DT
>style</DT
><DD
><P
><A
NAME="AEN6860"
></A
>To run various readability <A
NAME="AEN6862"
></A
>tests on a particular <A
NAME="AEN6864"
></A
>text file. Will output <A
NAME="AEN6866"
></A
>scores <A
NAME="AEN6868"
></A
>on a number of different <A
NAME="AEN6870"
></A
>readability <A
NAME="AEN6872"
></A
>tests (with no options).</P
><P
>Command syntax: </P
><PRE
CLASS="SCREEN"
>style -options text_file</PRE
><DIV
CLASS="NOTE"
><BLOCKQUOTE
CLASS="NOTE"
><P
><B
>Find style in the diction package: </B
>This command is part of the diction package and does not appear to be used too often these days</P
></BLOCKQUOTE
></DIV
></DD
><DT
>cmp</DT
><DD
><P
><A
NAME="AEN6883"
></A
>Determines whether or not two files differ, works on any type of file. Very similar to <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>diff</I
></SPAN
> only it compares <A
NAME="AEN6886"
></A
>on the binary <A
NAME="AEN6888"
></A
>level instead of just the text.</P
></DD
><DT
>diff</DT
><DD
><P
><A
NAME="AEN6894"
></A
>Compares two text files and output a difference <A
NAME="AEN6896"
></A
>report (sometimes called a &quot;diff&quot;<A
NAME="AEN6898"
></A
>) containing the text that differs between two files. </P
><P
>Can be used to create a 'patch' file (which can be used by <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>patch</I
></SPAN
>). </P
><P
>Example:</P
><PRE
CLASS="SCREEN"
>diff file1.txt file2.txt</PRE
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>diff</I
></SPAN
> will output <A
NAME="AEN6906"
></A
>a '&gt;' (followed by the line) for each line <A
NAME="AEN6908"
></A
>that isn't in the first file but is in the second file, and it will output a '&lt;' (followed by the line) for each line that is in the first file but not in the second file.</P
></DD
><DT
>sdiff</DT
><DD
><P
><A
NAME="AEN6914"
></A
>Instead of giving a difference <A
NAME="AEN6916"
></A
>report, it outputs <A
NAME="AEN6918"
></A
>the files in two columns,<A
NAME="AEN6920"
></A
> side by side, separated <A
NAME="AEN6922"
></A
>by spaces.<A
NAME="AEN6924"
></A
></P
></DD
><DT
>diff3</DT
><DD
><P
><A
NAME="AEN6930"
></A
>Same as <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>diff</I
></SPAN
> except for three files.</P
></DD
><DT
></DT
><DD
><P
>&nbsp;</P
></DD
><DT
>comm</DT
><DD
><P
><A
NAME="AEN6941"
></A
>Compares two files, line-by-line <A
NAME="AEN6943"
></A
>and prints <A
NAME="AEN6945"
></A
>lines that are unique <A
NAME="AEN6947"
></A
>to file1 <A
NAME="AEN6949"
></A
>(1st column), unique to file2<A
NAME="AEN6951"
></A
> (2nd column) and common <A
NAME="AEN6953"
></A
>to both files (3rd column). </P
><P
>Use <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>comm</I
></SPAN
> with the -1, -2, or -3 to suppress <A
NAME="AEN6957"
></A
>the printing <A
NAME="AEN6959"
></A
>of those particular lines. Simply run <A
NAME="AEN6961"
></A
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>comm</I
></SPAN
> to have all three listed <A
NAME="AEN6964"
></A
>(ie. unique <A
NAME="AEN6966"
></A
>to files 1 and 2 and common <A
NAME="AEN6968"
></A
>to both).</P
><P
>Command syntax:</P
><PRE
CLASS="SCREEN"
>comm file1 file2</PRE
></DD
><DT
>look</DT
><DD
><P
><A
NAME="AEN6976"
></A
>To output a list of words in the system dictionary that begin with a given string <A
NAME="AEN6978"
></A
>-- this is useful for finding <A
NAME="AEN6980"
></A
>words that begin with a particular phrase <A
NAME="AEN6982"
></A
>or prefix.<A
NAME="AEN6984"
></A
> </P
><P
>Give the string as an argument;<A
NAME="AEN6987"
></A
> it is not case sensitive.<A
NAME="AEN6989"
></A
> </P
><P
>Command syntax:</P
><PRE
CLASS="SCREEN"
>look string</PRE
></DD
></DL
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x6546.htm"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="book1.htm"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x6993.htm"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Text Viewing Tools</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="c6435.htm"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Text manipulation tools</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>