srodowisko_programisty/lab1/6.bash

8 lines
208 B
Bash
Raw Normal View History

2024-10-11 11:37:25 +02:00
#!/usr/bin/env bash
for word in $(grep -Roh '\w*' "$1" | sort | uniq)
do
2024-10-13 21:13:20 +02:00
occurences=$(grep -REn ".*\b$word\b.*\b$word\b.*" "$1")
2024-10-11 11:55:34 +02:00
[ -n "$occurences" ] && printf '%s:\n%s\n' "$word" "$occurences"
2024-10-11 11:37:25 +02:00
done