Skip to content

sort | uniq -c equivalent #1677

Answered by jqnatividad
alperyilmaz asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @alperyilmaz ,

You can achieve this with qsv frequency by specifying --no-headers and a --delimiter that doesn't occur in the file:

$ echo -e "a,1\nb,2\na,1" | qsv frequency --no-headers --delimiter '|'
field,value,count
1,"a,1",2
1,"b,2",1

# to get exactly the output you want
$ echo -e "a,1\nb,2\na,1" | qsv frequency --no-headers --delimiter '|' \
  | qsv select count,value | qsv behead \
  | qsv fmt --quote-never --out-delimiter ' '
2 a,1
1 b,2

Replies: 6 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by jqnatividad
Comment options

You must be logged in to vote
3 replies
@alperyilmaz
Comment options

@13minutes-yt
Comment options

@aborruso
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants
Converted from issue

This discussion was converted from issue #1676 on March 19, 2024 11:06.