diff --git a/lab1/2.bash b/lab1/2.bash index f585a90..11b858d 100755 --- a/lab1/2.bash +++ b/lab1/2.bash @@ -1,3 +1,3 @@ #!/usr/bin/env bash -grep -Roh '\w*' "$1" | sort | uniq -c | sort -nr +grep -Roh '\w*' "$1" | sort | uniq -c diff --git a/lab1/3.bash b/lab1/3.bash index e9e7b5f..0a10790 100755 --- a/lab1/3.bash +++ b/lab1/3.bash @@ -2,5 +2,5 @@ for word in $(grep -Roh '\w*' "$1" | sort | uniq) do - echo "$(grep -lRw "$word" "$1" | wc -l) $word" -done | sort -r + echo "$word: $(grep -lRw "$word" "$1" | wc -l)" +done | sort -n diff --git a/lab1/6.bash b/lab1/6.bash index c4d98c3..e233b1b 100755 --- a/lab1/6.bash +++ b/lab1/6.bash @@ -2,6 +2,6 @@ for word in $(grep -Roh '\w*' "$1" | sort | uniq) do - occurences=$(grep -REn "($word.*){2}" "$1") + occurences=$(grep -REn ".*\b$word\b.*\b$word\b.*" "$1") [ -n "$occurences" ] && printf '%s:\n%s\n' "$word" "$occurences" done