bash - How to find unique words from file linux -
i have big file, teh lines text numbers etc. [man-(some numers)] lot of man-somenumbers repeat in few lines, want count unique mans -words. cant use unique file , because text before man words different in each line. how can count unique man-somenumbers words in file ?
if understand want correctly, then
grep -oe 'man-[0-9]+' filename | sort | uniq -c
should trick. works follows: first
grep -oe 'man-[0-9]+' filename
isolates words file match man-[0-9]+
regular expression. list piped through sort
sorted list uniq
requires, , sorted list piped through uniq -c
count how each unique man-
word appears.
Comments
Post a Comment