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'