From ae701c75b815ec064c0af2a8395f95c8472b3ce7 Mon Sep 17 00:00:00 2001 From: Kotov_Alexei Date: Wed, 2 Nov 2022 17:50:41 +0000 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D0=BB(=D0=B0)=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B2=20''?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hw3_ex10.sh | 7 +++++++ hw3_ex6.sh | 10 ++++++++++ hw3_ex7.sh | 4 ++++ hw3_ex8.sh | 9 +++++++++ hw3_ex9.sh | 3 +++ 5 files changed, 33 insertions(+) create mode 100644 hw3_ex10.sh create mode 100644 hw3_ex6.sh create mode 100644 hw3_ex7.sh create mode 100644 hw3_ex8.sh create mode 100644 hw3_ex9.sh diff --git a/hw3_ex10.sh b/hw3_ex10.sh new file mode 100644 index 0000000..9214766 --- /dev/null +++ b/hw3_ex10.sh @@ -0,0 +1,7 @@ +#!/bin/bash +uniq_colors=$( awk -F';' '!seen[$5]++ {if($5!="color")print($5)}' test.txt ) +for i in $uniq_colors +do + COUNT=1 + awk -v s=$i -v COUNT=$COUNT -F';' '{ if ($5==s) {{ COUNT++ } if (COUNT%2==1) {var1=sin($4)/cos($4); printf($2"\t"); printf("%.4f\n",var1)} } }' test.txt +done diff --git a/hw3_ex6.sh b/hw3_ex6.sh new file mode 100644 index 0000000..7696510 --- /dev/null +++ b/hw3_ex6.sh @@ -0,0 +1,10 @@ +#!/bin/bash +read WORD +REV=$(echo $WORD | rev) +echo $REV +if [ "$REV" = "$WORD" ] +then + echo '**YES**' +else + echo '**NO**' +fi diff --git a/hw3_ex7.sh b/hw3_ex7.sh new file mode 100644 index 0000000..9ba0068 --- /dev/null +++ b/hw3_ex7.sh @@ -0,0 +1,4 @@ +#!/bin/bash +while IFS= read -r line; do + factor $line >> $2 +done < $1 diff --git a/hw3_ex8.sh b/hw3_ex8.sh new file mode 100644 index 0000000..c54de7d --- /dev/null +++ b/hw3_ex8.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +find . -type f -mtime -2 ! -mmin -1 ! -name '*.sh' -print0 | + while IFS= read -r -d '' line + do + part1=$(dirname "$line") + part2=$(basename "$line") + mv $line $part1'/'$add$part2 + done diff --git a/hw3_ex9.sh b/hw3_ex9.sh new file mode 100644 index 0000000..a84e10f --- /dev/null +++ b/hw3_ex9.sh @@ -0,0 +1,3 @@ +#!/bin/bash +s=$(cal|cat -vet|grep -o '_^H.'|grep -o '[[:digit:]]') +echo $s | sed 's/ //g'