2nd_Sem_Bogachev/2025.05.02/tests/find_str.sh
2025-04-30 21:24:42 +03:00

19 lines
490 B
Bash
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Проверяем, передан ли файл как аргумент
if [ $# -eq 0 ]; then
echo "Использование: $0 <имя_файла>"
exit 1
fi
input_file="$1"
# Проверяем существование файла
if [ ! -f "$input_file" ]; then
echo "Ошибка: файл '$input_file' не существует"
exit 1
fi
# Ищем строки с " Res = " и выводим их
grep " Res = " "$input_file" > found_str.log