This commit is contained in:
jacekpoz 2024-10-11 11:37:25 +02:00
commit c054752be7
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8
6 changed files with 29 additions and 0 deletions

3
lab1/1.bash Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
find "$1" -type f

3
lab1/2.bash Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
grep -Roh '\w*' "$1" | sort | uniq -c | sort -nr

6
lab1/3.bash Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env bash
for word in $(grep -Roh '\w*' "$1" | sort | uniq)
do
echo "$(grep -lRw "$word" "$1" | wc -l) $word"
done | sort -r

7
lab1/4.bash Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env bash
for word in $(grep -Roh '\w*' "$1" | sort | uniq)
do
echo "current word: $word"
grep -Rw "$word" "$1"
done

3
lab1/5.bash Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
find "$1" -type f -print0 | xargs -0 sed -i "s/a/A/g"

7
lab1/6.bash Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env bash
for word in $(grep -Roh '\w*' "$1" | sort | uniq)
do
echo "current word: $word"
grep -RE "($word.*){2}" "$1"
done