I have a file strings.txt
listing strings, which I am processing like this:
sort strings.txt | uniq -c | sort -n > uniq.counts
So the resulting file uniq.counts
will list uniq strings sorted in the ascending order by their counts, so something like this:
1 some string with spaces
5 some-other,string
25 most;frequent:string
Note that strings in strings.txt
may contain spaces, commas, semicolons and other separators, except for the tab. How can I get uniq.counts
to be in this format:
1<tab>some string with spaces
5<tab>some-other,string
25<tab>most;frequent:string