[root@firstcentos scripts]# cat test1
00
00
01
01
00
00
02
02
03
aa
aa
aa
[root@firstcentos scripts]# cat test1 | uniq -c
2 00
2 01
2 00
2 02
1 03
3 aa
[root@firstcentos scripts]#
If you want to remove the leading spaces, just pipe the output to sed to do so:
uniq -c file | sed 's/^\s*//'
Example:
$ uniq -c file
2 00
2 01
2 00
2 02
1 03
3 aa
$ uniq -c file | sed 's/^\s*//'
2 00
2 01
2 00
2 02
1 03
3 aa
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With