banana ranger 2021-09-15 09:24 采纳率: 25%
浏览 10
已结题

想要用uniq指令只根据前两列进行筛选,有没有实现方法?

查看uniq --help得到如下使用方法和参数:

Usage: uniq [OPTION]... [INPUT [OUTPUT]]
Filter adjacent matching lines from INPUT (or standard input),
writing to OUTPUT (or standard output).

With no options, matching lines are merged to the first occurrence.

Mandatory arguments to long options are mandatory for short options too.
  -c, --count           prefix lines by the number of occurrences
  -d, --repeated        only print duplicate lines, one for each group
  -D, --all-repeated[=METHOD]  print all duplicate lines
                          groups can be delimited with an empty line
                          METHOD={none(default),prepend,separate}
 ** -f, --skip-fields=N   avoid comparing the first N fields**
      --group[=METHOD]  show all items, separating groups with an empty line
                          METHOD={separate(default),prepend,append,both}
  -i, --ignore-case     ignore differences in case when comparing
  -s, --skip-chars=N    avoid comparing the first N characters
  -u, --unique          only print unique lines
  -z, --zero-terminated  end lines with 0 byte, not newline
  -w, --check-chars=N   compare no more than N characters in lines

因为我的数据只需要根据前两列筛去重复项就可以出结果了,如果能用uniq会非常简单,但它似乎没有这个功能(只能跳过前几列),而我的数据字符数不保持相同,所以另外几个参数-w似乎也用不了,大家有什么办法么?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 系统已结题 9月23日
    • 创建了问题 9月15日

    悬赏问题

    • ¥15 在matlab中Application Compiler后的软件无法打开
    • ¥15 想问一下STM32创建工程模板时遇到得问题
    • ¥15 Fiddler抓包443
    • ¥20 Qt Quick Android 项目报错及显示问题
    • ¥15 而且都没有 OpenCVConfig.cmake文件我是不是需要安装opencv,如何解决?
    • ¥15 oracleBIEE analytics
    • ¥15 H.264选择性加密例程
    • ¥50 windows的SFTP服务器如何能批量同步用户信息?
    • ¥15 centos7.9升级python3.0的问题
    • ¥15 安装CentOS6时卡住