358 lines
5.5 KiB
HTML
358 lines
5.5 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|||
|
<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="index.html"><LINK
|
|||
|
REL="UP"
|
|||
|
TITLE="Text Related Tools"
|
|||
|
HREF="text-related-tools.html"><LINK
|
|||
|
REL="PREVIOUS"
|
|||
|
TITLE="Text Viewing Tools "
|
|||
|
HREF="text-viewing-tools.html"><LINK
|
|||
|
REL="NEXT"
|
|||
|
TITLE="Text manipulation tools"
|
|||
|
HREF="text-manipulation-tools.html"></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="text-viewing-tools.html"
|
|||
|
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="text-manipulation-tools.html"
|
|||
|
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
|
|||
|
>11.3. Text Information Tools</H1
|
|||
|
><P
|
|||
|
></P
|
|||
|
><P
|
|||
|
></P
|
|||
|
><DIV
|
|||
|
CLASS="VARIABLELIST"
|
|||
|
><DL
|
|||
|
><DT
|
|||
|
>wc</DT
|
|||
|
><DD
|
|||
|
><P
|
|||
|
>Word count, count how many words you have in a text document. Can also be used to count the lines or bytes within the file. </P
|
|||
|
><P
|
|||
|
>Use the options<EM
|
|||
|
> -w </EM
|
|||
|
>for words, <EM
|
|||
|
>-l </EM
|
|||
|
>for lines and <EM
|
|||
|
>-c </EM
|
|||
|
>for bytes. Or simply run <EM
|
|||
|
>wc</EM
|
|||
|
> with no options to get all three.</P
|
|||
|
><P
|
|||
|
>Command syntax:</P
|
|||
|
><TABLE
|
|||
|
BORDER="1"
|
|||
|
BGCOLOR="#E0E0E0"
|
|||
|
WIDTH="90%"
|
|||
|
><TR
|
|||
|
><TD
|
|||
|
><FONT
|
|||
|
COLOR="#000000"
|
|||
|
><PRE
|
|||
|
CLASS="SCREEN"
|
|||
|
>wc -option file.txt</PRE
|
|||
|
></FONT
|
|||
|
></TD
|
|||
|
></TR
|
|||
|
></TABLE
|
|||
|
></DD
|
|||
|
><DT
|
|||
|
>style</DT
|
|||
|
><DD
|
|||
|
><P
|
|||
|
>To run various readability tests on a particular text file. Will output scores on a number of different readability tests (with no options).</P
|
|||
|
><P
|
|||
|
>Command syntax: </P
|
|||
|
><TABLE
|
|||
|
BORDER="1"
|
|||
|
BGCOLOR="#E0E0E0"
|
|||
|
WIDTH="90%"
|
|||
|
><TR
|
|||
|
><TD
|
|||
|
><FONT
|
|||
|
COLOR="#000000"
|
|||
|
><PRE
|
|||
|
CLASS="SCREEN"
|
|||
|
>style -options text_file</PRE
|
|||
|
></FONT
|
|||
|
></TD
|
|||
|
></TR
|
|||
|
></TABLE
|
|||
|
><DIV
|
|||
|
CLASS="NOTE"
|
|||
|
><P
|
|||
|
></P
|
|||
|
><TABLE
|
|||
|
CLASS="NOTE"
|
|||
|
WIDTH="90%"
|
|||
|
BORDER="0"
|
|||
|
><TR
|
|||
|
><TD
|
|||
|
WIDTH="25"
|
|||
|
ALIGN="CENTER"
|
|||
|
VALIGN="TOP"
|
|||
|
><IMG
|
|||
|
SRC="../images/note.gif"
|
|||
|
HSPACE="5"
|
|||
|
ALT="Note"></TD
|
|||
|
><TH
|
|||
|
ALIGN="LEFT"
|
|||
|
VALIGN="CENTER"
|
|||
|
><B
|
|||
|
>Find style in the diction package</B
|
|||
|
></TH
|
|||
|
></TR
|
|||
|
><TR
|
|||
|
><TD
|
|||
|
> </TD
|
|||
|
><TD
|
|||
|
ALIGN="LEFT"
|
|||
|
VALIGN="TOP"
|
|||
|
><P
|
|||
|
>This command is part of the diction package and does not appear to be used too often these days</P
|
|||
|
></TD
|
|||
|
></TR
|
|||
|
></TABLE
|
|||
|
></DIV
|
|||
|
></DD
|
|||
|
><DT
|
|||
|
>cmp</DT
|
|||
|
><DD
|
|||
|
><P
|
|||
|
>Determines whether or not two files differ, works on any type of file. Very similar to <EM
|
|||
|
>diff</EM
|
|||
|
> only it compares on the binary level instead of just the text.</P
|
|||
|
></DD
|
|||
|
><DT
|
|||
|
>diff</DT
|
|||
|
><DD
|
|||
|
><P
|
|||
|
>Compares two text files and output a difference report (sometimes called a "diff") containing the text that differs between two files. </P
|
|||
|
><P
|
|||
|
>Can be used to create a 'patch' file (which can be used by <EM
|
|||
|
>patch</EM
|
|||
|
>). </P
|
|||
|
><P
|
|||
|
>Example:</P
|
|||
|
><TABLE
|
|||
|
BORDER="1"
|
|||
|
BGCOLOR="#E0E0E0"
|
|||
|
WIDTH="90%"
|
|||
|
><TR
|
|||
|
><TD
|
|||
|
><FONT
|
|||
|
COLOR="#000000"
|
|||
|
><PRE
|
|||
|
CLASS="SCREEN"
|
|||
|
>diff file1.txt file2.txt</PRE
|
|||
|
></FONT
|
|||
|
></TD
|
|||
|
></TR
|
|||
|
></TABLE
|
|||
|
><P
|
|||
|
><EM
|
|||
|
>diff</EM
|
|||
|
> will output a '>' (followed by the line) for each line that isn't in the first file but is in the second file, and it will output a '<' (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
|
|||
|
>Instead of giving a difference report, it outputs the files in two columns, side by side, separated by spaces.</P
|
|||
|
></DD
|
|||
|
><DT
|
|||
|
>diff3</DT
|
|||
|
><DD
|
|||
|
><P
|
|||
|
>Same as <EM
|
|||
|
>diff</EM
|
|||
|
> except for three files.</P
|
|||
|
></DD
|
|||
|
><DT
|
|||
|
></DT
|
|||
|
><DD
|
|||
|
><P
|
|||
|
><3E></P
|
|||
|
></DD
|
|||
|
><DT
|
|||
|
>comm</DT
|
|||
|
><DD
|
|||
|
><P
|
|||
|
>Compares two files, line-by-line and prints lines that are unique to file1 (1st column), unique to file2 (2nd column) and common to both files (3rd column). </P
|
|||
|
><P
|
|||
|
>Use <EM
|
|||
|
>comm</EM
|
|||
|
> with the -1, -2, or -3 to suppress the printing of those particular lines. Simply run <EM
|
|||
|
>comm</EM
|
|||
|
> to have all three listed (ie. unique to files 1 and 2 and common to both).</P
|
|||
|
><P
|
|||
|
>Command syntax:</P
|
|||
|
><TABLE
|
|||
|
BORDER="1"
|
|||
|
BGCOLOR="#E0E0E0"
|
|||
|
WIDTH="90%"
|
|||
|
><TR
|
|||
|
><TD
|
|||
|
><FONT
|
|||
|
COLOR="#000000"
|
|||
|
><PRE
|
|||
|
CLASS="SCREEN"
|
|||
|
>comm file1 file2</PRE
|
|||
|
></FONT
|
|||
|
></TD
|
|||
|
></TR
|
|||
|
></TABLE
|
|||
|
></DD
|
|||
|
><DT
|
|||
|
>look</DT
|
|||
|
><DD
|
|||
|
><P
|
|||
|
>To output a list of words in the system dictionary that begin with a given string -- this is useful for finding words that begin with a particular phrase or prefix. </P
|
|||
|
><P
|
|||
|
>Give the string as an argument; it is not case sensitive. </P
|
|||
|
><P
|
|||
|
>Command syntax:</P
|
|||
|
><TABLE
|
|||
|
BORDER="1"
|
|||
|
BGCOLOR="#E0E0E0"
|
|||
|
WIDTH="90%"
|
|||
|
><TR
|
|||
|
><TD
|
|||
|
><FONT
|
|||
|
COLOR="#000000"
|
|||
|
><PRE
|
|||
|
CLASS="SCREEN"
|
|||
|
>look string</PRE
|
|||
|
></FONT
|
|||
|
></TD
|
|||
|
></TR
|
|||
|
></TABLE
|
|||
|
></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="text-viewing-tools.html"
|
|||
|
ACCESSKEY="P"
|
|||
|
>Prev</A
|
|||
|
></TD
|
|||
|
><TD
|
|||
|
WIDTH="34%"
|
|||
|
ALIGN="center"
|
|||
|
VALIGN="top"
|
|||
|
><A
|
|||
|
HREF="index.html"
|
|||
|
ACCESSKEY="H"
|
|||
|
>Home</A
|
|||
|
></TD
|
|||
|
><TD
|
|||
|
WIDTH="33%"
|
|||
|
ALIGN="right"
|
|||
|
VALIGN="top"
|
|||
|
><A
|
|||
|
HREF="text-manipulation-tools.html"
|
|||
|
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="text-related-tools.html"
|
|||
|
ACCESSKEY="U"
|
|||
|
>Up</A
|
|||
|
></TD
|
|||
|
><TD
|
|||
|
WIDTH="33%"
|
|||
|
ALIGN="right"
|
|||
|
VALIGN="top"
|
|||
|
>Text manipulation tools</TD
|
|||
|
></TR
|
|||
|
></TABLE
|
|||
|
></DIV
|
|||
|
></BODY
|
|||
|
></HTML
|
|||
|
>
|