官术网_书友最值得收藏!

The uniq command

The following are a few examples showing the usage of the uniq command:

  • This command removes duplicate adjacent lines from the file:
    $ cat test
    aa
    aa
    cc
    cc
    bb
    bb
    yy
    zz
    $ uniq test
  • This output removes the duplicate adjacent lines from test file, shown as follows:
    aa
    cc
    bb
    yy
    zz
  • The next command only prints duplicate lines:
    $ uniq -d test
  • Output:
    aa
    cc
    bb
  • The following command prints the number of occurrences of all elements on an inpidual line:
    $ uniq -c test
  • Output:
    2 aa
    2 cc
    2 bb
    1 yy
    1 zz
主站蜘蛛池模板: 栾川县| 高安市| 松潘县| 旅游| 萝北县| 石河子市| 洛南县| 开封县| 车致| 扬中市| 和田县| 景泰县| 东平县| 神木县| 苗栗县| 吕梁市| 荆州市| 延川县| 巴楚县| 兴山县| 永丰县| 青浦区| 惠安县| 五莲县| 德惠市| 江山市| 怀仁县| 辽中县| 河北区| 拉孜县| 邓州市| 富锦市| 泰宁县| 鄂托克旗| 绥德县| 巴楚县| 营口市| 阜城县| 江达县| 岑巩县| 铁岭市|