Solved

Shell Script

Posted on 2004-10-10
2
183 Views
Last Modified: 2010-04-15
I used uniq -c to list the number of occurrences of each line from a text file.

I see the numbers outputted but what I want is only the lines with 1 occurrence.

How do I pull just these lines out?

Thank you.
0
Comment
Question by:siggyjav
  • 2
2 Comments
 
LVL 23

Accepted Solution

by:
brettmjohnson earned 500 total points
ID: 12273643
uniq -c | awk '{if ($1 == 1) print $0}'
0
 
LVL 23

Expert Comment

by:brettmjohnson
ID: 12273666
More obviously, why not use uniq -u ?

     -u      Don't output lines that are repeated in the input.

0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Inorder binary search tree 5 158
why "." vs "->" 23 119
UPD maximums on Red Hat 6 110
Detect CR LF to each line 12 153
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now