Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HW2 #910

Open
wants to merge 5 commits into
base: AKataev/main
Choose a base branch
from
Open

HW2 #910

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions sum.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

if [ "$#" -ne 2 ]; then
echo "Ошибка: требуется два аргумента"
exit 1
fi

numReg="^-?[0-9]+([.][0-9]+)?$"

if ! [[ $1 =~ $numReg && $2 =~ $numReg ]]; then
echo "Введите корректные числа"
exit 1
fi


result=$(awk "BEGIN {print $1 + $2}")

echo "Результат сложения $1 + $2 = $result"
4 changes: 4 additions & 0 deletions users.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash


awk '{print $3}' users.txt | sort | uniq -c | sort -nr | head -n 3
6 changes: 6 additions & 0 deletions users.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
id user city phone
1 test Moscow 1234123
2 test2 Saint-P 1232121
3 test3 Tver 4352124
4 test4 Milan 7990923
5 test5 Moscow 908213