what is the use of uniq commmand?

Answers were Sorted based on User's Feedback



what is the use of uniq commmand?..

Answer / suitable

uniq command removes the duplicate lines from the sorted
file and display on the standard output. the original file
remains unchanged.

Is This Answer Correct ?    5 Yes 1 No

what is the use of uniq commmand?..

Answer / rhino

Small correction to Answer #3 If the line is repeated in
the very next line it will be removed , Else this will be
displayed as if it is a new number

Ex. as below -- This has been cross checked before answering


Ex : File duplitest has below lines

RohiBaby
RohiBaby
GunduBaby
ChinniBaby
RohiBaby
Rohith

cmd. : cat duplitest | uniq -- Gives below o/p

RohiBaby
GunduBaby
ChinniBaby
RohiBaby
Rohith

Is This Answer Correct ?    4 Yes 0 No

what is the use of uniq commmand?..

Answer / jagadeeb choudhury

The Uniq command is used to report and Remove repeated line
in a file.
This is a value able tool for a lot of scripting and Testing.
Ex-
$ uniq Duplicate_line No_duplicate_line

If You want to see without repeated lines
Ex-
$ cat repeated_line_file | uniq


Thanks,
Jagadeeb@gmail.com

Is This Answer Correct ?    3 Yes 1 No

what is the use of uniq commmand?..

Answer / rhino

Sorry Typo error in Answer #4 -- Please read as below

** it will be removed -- it will not be removed

Is This Answer Correct ?    2 Yes 0 No

what is the use of uniq commmand?..

Answer / saurabh

This is the output of the command:
>cat skg.txt
aa
aa
bb
cc
bb
dd
cc
ee

--------------

>cat skg.txt | uniq

aa
bb
cc
bb
dd
cc
ee

Is This Answer Correct ?    2 Yes 0 No

what is the use of uniq commmand?..

Answer / amedela chandra sekhar

simple it display the unique data in the file

Is This Answer Correct ?    0 Yes 0 No

what is the use of uniq commmand?..

Answer / yuvaevergreen

report duplicate lines

Is This Answer Correct ?    0 Yes 0 No

what is the use of uniq commmand?..

Answer / giridhar tarare

uniq command search the uniq data in file and if some
duplicate date then it put only single records in report.

For Example: cat testnumber.txt | uniq <enter>

File contents:
1233
456
678
1233
678

output file shows:
1233
456
678

Is This Answer Correct ?    3 Yes 7 No

Post New Answer

More Unix Commands Interview Questions

How does a user get the current date, time in UNIX?

6 Answers   IBM,


what is the use of "test" command in unix?

4 Answers  


distinguish between multi-tasking,multi-user,multi- processing and time sharing?

7 Answers   Alcatel, Cisco, Infosys, University Exams,


what is the functionality of kernel in unix architecture?

13 Answers   HCL,


How do you stop a running process?

7 Answers  






fork in unix ?

4 Answers   BFL,


Where can I get the free download of Unix by Yeswant Kanetkar?

5 Answers  


What is the basic difference between unix and windows operating systems?

43 Answers   Bopro, College School Exams Tests, CTS, IBM, IT-Kids, Priyadarshini, Sybian Technologies, Tolani Maritime,


Which mode is used for allowing file write,read and append mode?

9 Answers   BitWise, TM,


What does find command return in unix?

0 Answers  


Can you explain a little bit about command substitution?

0 Answers  


distinguish between physical addresses and logical address?

3 Answers   Infosys,


Categories