commit c054752be74860f16af46d6c1343414fc5bb4620 Author: jacekpoz Date: Fri Oct 11 11:37:25 2024 +0200 l1 diff --git a/lab1/1.bash b/lab1/1.bash new file mode 100755 index 0000000..f9d9029 --- /dev/null +++ b/lab1/1.bash @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +find "$1" -type f diff --git a/lab1/2.bash b/lab1/2.bash new file mode 100755 index 0000000..f585a90 --- /dev/null +++ b/lab1/2.bash @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +grep -Roh '\w*' "$1" | sort | uniq -c | sort -nr diff --git a/lab1/3.bash b/lab1/3.bash new file mode 100755 index 0000000..e9e7b5f --- /dev/null +++ b/lab1/3.bash @@ -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 diff --git a/lab1/4.bash b/lab1/4.bash new file mode 100755 index 0000000..8e99c98 --- /dev/null +++ b/lab1/4.bash @@ -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 diff --git a/lab1/5.bash b/lab1/5.bash new file mode 100755 index 0000000..ad7da51 --- /dev/null +++ b/lab1/5.bash @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +find "$1" -type f -print0 | xargs -0 sed -i "s/a/A/g" diff --git a/lab1/6.bash b/lab1/6.bash new file mode 100755 index 0000000..1d1281e --- /dev/null +++ b/lab1/6.bash @@ -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