linux - 我应该如何计算每个文件中的重复行?

标签 linux shell unix

我已经试过了:

dirs=$1
for dir in $dirs
do
        ls -R  $dir             
done

最佳答案

像这样?

$ cat > foo
this
nope
$ cat > bar
neither
this

$ sort *|uniq -c
  1 neither
  1 nope
  2 this

并剔除只有 1 的那些:

... | awk '$1>1'
      2 this

关于linux - 我应该如何计算每个文件中的重复行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43783960/

相关文章:

linux - Unix中用户信息的错误处理

unix - El-cheapo如何监视群集中的任务并在它们崩溃时重新启动( self 修复)?

unix -/etc/passwd 与/usr/bin/passwd

linux - 在 sed 中使用变量

linux - 在 bash 脚本中评估命令导致 $SHLVL 增加

linux - 如何将带空格的参数传递给 sed 命令?

python - 在 Python 中更改调用者的当前工作目录

linux - 通过 Docker 调用 OCRmyPDF 的 bash 脚本的错误响应

java - Linux 'screen' 不会从磁盘读取

python - 我如何告诉 python 启动用户默认终端?