srodowisko_programisty/lab1/6.bash

7 lines
208 B
Bash
Executable file

#!/usr/bin/env bash
for word in $(grep -Roh '\w*' "$1" | sort | uniq)
do
occurences=$(grep -REn ".*\b$word\b.*\b$word\b.*" "$1")
[ -n "$occurences" ] && printf '%s:\n%s\n' "$word" "$occurences"
done