简体   繁体   English

有没有一种方法可以使用uniq仅比较前n个字符?

[英]Is there a way to use uniq to compare only the first n characters?

According to the documentation, 根据文档,

http://www.computerhope.com/unix/uuniq.htm http://www.computerhope.com/unix/uuniq.htm

The command can be used to ignore the first n characters 该命令可用于忽略前n个字符

Suppose I wish to have the following 假设我希望有以下内容

03/08/2002,2,HUST,RICC,53.0,,2.3,J S BULLARD,,2,2,3/3,46.0,,,
03/08/2002,2,HUST,RICC,53.0,,WON,M J WALKER,,10,1,2/2,49.5,,,

Matched as identical based on the first 20 characters. 根据前20个字符进行匹配。 Is there a way to do this? 有没有办法做到这一点?

My uniq manual (coreutils 8.5) says: 我的uniq手册(coreutils 8.5)说:

 -w, --check-chars=N compare no more than N characters in lines 

This however isn't standard (thus won't work on other Unixes). 但是,这不是标准的 (因此在其他Unix上将无法使用)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM