From c054752be74860f16af46d6c1343414fc5bb4620 Mon Sep 17 00:00:00 2001 From: jacekpoz Date: Fri, 11 Oct 2024 11:37:25 +0200 Subject: [PATCH] l1 --- lab1/1.bash | 3 +++ lab1/2.bash | 3 +++ lab1/3.bash | 6 ++++++ lab1/4.bash | 7 +++++++ lab1/5.bash | 3 +++ lab1/6.bash | 7 +++++++ 6 files changed, 29 insertions(+) create mode 100755 lab1/1.bash create mode 100755 lab1/2.bash create mode 100755 lab1/3.bash create mode 100755 lab1/4.bash create mode 100755 lab1/5.bash create mode 100755 lab1/6.bash 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