Suppose you want to search for lines containing specific text then you want to see the distinct count for all words in all those lines.
1. From git-bash run the following command:
grep -r "word_to_search" ./folder_to_search_in/ | awk -F ":" '{print $2}' > result_file
2. Now run the following command on result_file produces by the command above
cat result_file | tr -s ' ' '\n' | sort | uniq -c | sort -r | awk '{ print $2, $1 }' > outuniq
3. Now file outuniq will contain the uniq words and count for their occurance
1. From git-bash run the following command:
grep -r "word_to_search" ./folder_to_search_in/ | awk -F ":" '{print $2}' > result_file
2. Now run the following command on result_file produces by the command above
cat result_file | tr -s ' ' '\n' | sort | uniq -c | sort -r | awk '{ print $2, $1 }' > outuniq
3. Now file outuniq will contain the uniq words and count for their occurance
Niciun comentariu:
Trimiteți un comentariu