eXtropia: the open web technology company
Technology | Support | Tutorials | Development | About Us | Users | Contact Us
 ::   Tutorials
 ::   Presentations
Perl & CGI tutorials
 ::   Intro to Perl/CGI and HTML Forms
 ::   Intro to Windows Perl
 ::   Intro to Perl 5
 ::   Intro to Perl
 ::   Intro to Perl Taint mode
 ::   Sherlock Holmes and the Case of the Broken CGI Script
 ::   Writing COM Components in Perl

Java tutorials
 ::   Intro to Java
 ::   Cross Browser Java

Misc technical tutorials
 ::   Intro to The Web Application Development Environment
 ::   Introduction to XML
 ::   Intro to Web Design
 ::   Intro to Web Security
 ::   Databases for Web Developers
 ::   UNIX for Web Developers
 ::   Intro to Adobe Photoshop
 ::   Web Programming 101
 ::   Introduction to Microsoft DNA

Misc non-technical tutorials
 ::   Misc Technopreneurship Docs
 ::   What is a Webmaster?
 ::   What is the open source business model?
 ::   Technical writing
 ::   Small and mid-sized businesses on the Web

Offsite tutorials
 ::   ISAPI Perl Primer
 ::   Serving up web server basics
 ::   Introduction to Java (Parts 1 and 2) in Slovak


Introduction to UNIX for Web Developers
The "uniq" Utility  
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]

Previous | Next | Table of Contents