独特的线条在bash [英] Unique lines in bash

查看:104
本文介绍了独特的线条在bash的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在bash绝对新手,所以这里是我的问题:结果
文本行的任何数字都是从标准输入给出。结果
输出:非重复的行数结果
结果
例如:结果
输入:结果


  

她穿着黑色皮鞋。结果
  我的名字是佐尼。结果
  我讨厌星期一。结果
  我的名字是佐尼。结果
  我不理解你。结果
  她穿着黑色皮鞋。结果


OUTPUT:结果


  

2



解决方案

您可以尝试使用uniq的男人的uniq 并执行以下操作

 排序文件| uniq的-u |厕所-l

I'm absolutely novice in bash, so here is my problem:
Any number of lines of text is given from standard input.
Output: number of non repeating lines.

For example:
INPUT:

She is wearing black shoes.
My name is Johny.
I hate mondays.
My name is Johny.
I don't understand you.
She is wearing black shoes.

OUTPUT:

2

解决方案

You could try using uniq man uniq and do the following

sort file | uniq -u | wc -l

这篇关于独特的线条在bash的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆