date, wc, du, and more.

" />
x
Loading
 Loading
Hello, Guest | Login | Register

What’s GNU in Old Utilities, Part Seven

Here’s the last in a series about new features of perennial utilities. This time: date, wc, du, and more.

A lot of utilities have changed since the early days of Unix. This month, let’s take one last look at new features added to a few of the most common Linux utilities, including diff, wc, du, date, touch, and sed.

What’s Different About diff

GNU diff version 2.8.1 has more than forty options. (The Seventh Edition diff had four.) Covering all forty is impractical, so let’s focus on the customizable output formats of GNU diff.
The Seventh Edition diff had its default output format and the –e and –f formats. Later, the context (–c) format was added, then came the unified (–u) format. Now diff has the –D NAME option to merge two C language files into a single file with the preprocessor directives #ifdef NAME and #ifndef NAME. Modern diff also has a series of options such as ––line-format= fff, where fff is a printf()- like string, to control how diff formats difference listings. The latter series of options lets you produce almost any type of output.
Listing One shows two short files with the normal output format, the unified format, and a custom format using the line-format options.
Listing One: A sampling of different diff listing formats

$ diff old new
1a2
> line 1A
3d3
< line 3
5a6
> line 6

$ diff –u old new
— old 2006-01-16 14:35:27 -0700
+++ new…

Please log in to view this content.

Not Yet a Member?

Register with LinuxMagazine.com and get free access to the entire archive, including:

  • Hands-on Content
  • White Papers
  • Community Features
  • And more.
Already a Member?
Log in!
Username

Password

Remember me

Forgotten your password?
Forgotten your username?
Read More
  1. KDE 4.4: Does It Work Yet?
  2. Writing Custom Nagios Plugins with Python
  3. Power Up Linux GUI Apps
  4. Tweeting from the Command Line with Twyt
  5. When Memory Serves You: Using ramfs and tmpfs
Follow Linux Magazine
Rackspace