Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 196
  • Last Modified:

Shell Script

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
siggyjav
Asked:
siggyjav
  • 2
1 Solution
 
brettmjohnsonCommented:
uniq -c | awk '{if ($1 == 1) print $0}'
0
 
brettmjohnsonCommented:
More obviously, why not use uniq -u ?

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

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now