uniq options


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting uniq options
# 1  
Old 05-08-2008
uniq options

Hi
I am currently using uniq -u and uniq -d option in my program to get uniq and duplicate lines from file.

What i doing is
uniq -c file1>file_u
uniq -d file1>file_d
cat file_u file_d > file_fiinal

Since i am procesing a larger files the I/O operations is costly affair.
Hence I would like to know if there is any other option in uniq so that i can
directly use both the options.

Regards
dhana
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

uniq -c in the pipeline

Hello gurus - I must be missing something, or there is a better way - pls enlighten me I'm on a Solaris 10 vm running the following pipeline to reduce some apache logs (actually lynx dumps of /server-status/ when threads are above a threshold) to a set of offending DDoS IP addresses. awk... (10 Replies)
Discussion started by: fletch00
10 Replies

2. Shell Programming and Scripting

Uniq help

hello I want to check on first column duplicates and print the unique first and second columns My trial output is not generating what I needed, i.e the second column. thanks in advance (5 Replies)
Discussion started by: bhargavpbk88
5 Replies

3. Shell Programming and Scripting

Uniq not doing what I want it to

I have a master list of servers. I also have a list of servers I'm not supposed to touch. I'm trying to filter out the list servers that I'm not supposed to touch from the master list of servers, so I will have a "master list of servers I can touch". When I try to filter these I'm not getting... (4 Replies)
Discussion started by: MaindotC
4 Replies

4. Ubuntu

Kernel boot options removed by fault, no boot options

Hello Everyone, First of all, I highly appreciate all Linux forum members and whole Linux community. http://forums.linuxmint.com/images/smilies/icon_wink.gif. I wish you the best for all of you ! I will try to be short and concise: I am using Linux Mint 10 for 2 months on 2 ws, and all went... (3 Replies)
Discussion started by: cdt
3 Replies

5. Shell Programming and Scripting

uniq -c

When I do uniq -c on a list of sorted numbers, for eg: 1 1 2 2 2 3 3 4 It outputs 2 1 3 2 2 3 1 4. Now, is there a way to sort on the column that "uniq -c" produced? (2 Replies)
Discussion started by: prasanna1157
2 Replies

6. Shell Programming and Scripting

Help with Uniq and sort

The key is first field i want only uniq record for the first field in file. I want the output as or output as Appreciate help on this (4 Replies)
Discussion started by: pinnacle
4 Replies

7. UNIX for Dummies Questions & Answers

Difference between plain "uniq" and "uniq -u"

Dear all, It's not entirely clear to me from manpage the difference between them. Why we still need "-u" flag? - monkfan (3 Replies)
Discussion started by: monkfan
3 Replies

8. HP-UX

help on UniQ

All, Can anybody provide me the links to the documentation on UniQPrint? I need to prepare some documents to help my co-workers to learn UniQPrint. Regards, Vishal (0 Replies)
Discussion started by: vishal_ranjan
0 Replies
Login or Register to Ask a Question
UNIQ(1) 						    BSD General Commands Manual 						   UNIQ(1)

NAME
uniq -- report or filter out repeated lines in a file SYNOPSIS
uniq [-c | -d | -u] [-i] [-f num] [-s chars] [input_file [output_file]] DESCRIPTION
The uniq utility reads the specified input_file comparing adjacent lines, and writes a copy of each unique input line to the output_file. If input_file is a single dash ('-') or absent, the standard input is read. If output_file is absent, standard output is used for output. The second and succeeding copies of identical adjacent input lines are not written. Repeated lines in the input will not be detected if they are not adjacent, so it may be necessary to sort the files first. The following options are available: -c Precede each output line with the count of the number of times the line occurred in the input, followed by a single space. -d Only output lines that are repeated in the input. -f num Ignore the first num fields in each input line when doing comparisons. A field is a string of non-blank characters separated from adjacent fields by blanks. Field numbers are one based, i.e., the first field is field one. -s chars Ignore the first chars characters in each input line when doing comparisons. If specified in conjunction with the -f option, the first chars characters after the first num fields will be ignored. Character numbers are one based, i.e., the first character is character one. -u Only output lines that are not repeated in the input. -i Case insensitive comparison of lines. ENVIRONMENT
The LANG, LC_ALL, LC_COLLATE and LC_CTYPE environment variables affect the execution of uniq as described in environ(7). EXIT STATUS
The uniq utility exits 0 on success, and >0 if an error occurs. COMPATIBILITY
The historic +number and -number options have been deprecated but are still supported in this implementation. SEE ALSO
sort(1) STANDARDS
The uniq utility conforms to IEEE Std 1003.1-2001 (``POSIX.1'') as amended by Cor. 1-2002. HISTORY
A uniq command appeared in Version 3 AT&T UNIX. BSD
December 17, 2009 BSD