Need to remove the count from the output when using “uniq -c” command

后端 未结 5 779
有刺的猬
有刺的猬 2020-12-06 13:16

I am trying to read a file and sort it by number of occurrences of a particular field. Suppose i want to find out the most repeated date from a log file then i use uniq -c o

5条回答
  •  春和景丽
    2020-12-06 13:48

    Instead of cut -d' ' -f2, try

    awk '{$1="";print}'
    

    Maybe you need to remove one more blank in the beginning:

    awk '{$1="";print}' | sed 's/^.//'
    

    or completly with sed, preserving original whitspace:

    sed -r 's/^[^0-9]*[0-9]+//'
    

提交回复
热议问题