Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


The "uniq" Utility

July 19, 1998

Like the comm utility, the "uniq" utility is used to find repetition. However, the "uniq" utility is used to find repeated lines within a file rather than between two files. The "uniq" utility is used to find adjacent duplicate lines and (usually) remove them. The usual syntax looks something like:

uniq options filename optional_new_filename

If no optional_new_filename is specified, the output of uniq will be printed to standard output.

As you might expect, it is most common to run the uniq utility after having already sorted the file. Below is an example on how you might use the "uniq" utility.

[uniq Example]

The "uniq" utility comes with several useful utilities. The more common ones are described below.

Option Explanation
-c Produces a columnar output in which the left column reports the number of times the line was repeated
-d Displays one copy of each repeated line, but does not display non-repeated lines.
-u Non repeated lines are displayed, but repeated lines are not.

Consider the following examples:

[uniq Options Example]

The "comm" Utility
Introduction to UNIX for Web Developers | Table of Contents
The "spell" Utility


Up to => Home / Internet / UNIX / Intro




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers