Essential Linux

Text formatting

cmp

cmp [ -1 ] [ -s ] filel file2

This command compares two files and gives an indication if they differ. With no options, cmp prints a message with the first occurrence of a difference, giving the line and character number of the discrepancy. If there is no difference, nothing is printed and the normal prompt appears. It Returns various codes indicating the results of its testing. Code 0 means the files were identical, 1 for different files and 2 for missing or incorrect arguments. Its options are:

-I

Prints the byte number (decimal) and the differing bytes (octal) for each difference.

-s

Prints nothing for differing files and only Returns codes.

$cat filelThis is line 1.This is line 2.$cat file2This is line a.This is line b.$ cmp filel file2filel file2 differ: char 14, line 1$ cmp -1 filel file2    14  61 141    30  62 142    46  63 143$ cmp -s filel file2$

col

col [-b] [-f] [-x]

col reads from the standard input and writes onto the standard output and is used to provide the line overlays. It is capable of complete line overlays and forward and reverse half-line overlays, and is usually used with the nroff text formatter. Control characters are used to indicate when to perform these operations esc7 for a complete line, esc8 and esc9 for reverse and forward line feeds. The options are fairly simple:

-b

Assume that...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Graphic Overlay and Front Panel Services
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.