diff --git a/OS/bash/q5.sh b/OS/bash/q5.sh deleted file mode 100644 index acd1bce..0000000 --- a/OS/bash/q5.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -num_patterns=$(( $# )) -patterns=("${@:1:num_patterns}") -input_file="${!num_patterns}" - - -while true;do - echo "a. Search the patterns in the given input file." - echo "b. Delete all occurrences of the pattern in the given input file." - echo "c. Exit" - - read choice - - case "$choice" in - a) - echo "Searching patterns in $input_file:" - for pattern in "${patterns[@]}"; do - grep "$pattern" "$input_file" - done - ;; - b) - echo "Deleting occurrences of patterns in $input_file:" - for pattern in "${patterns[@]}"; do - sed -i "s/$pattern//g" "$input_file" - done - echo "Occurrences deleted." - ;; - c) - echo "Exiting..." - exit 0 - ;; - *) - echo "Invalid choice. Please enter 'a', 'b', or 'c'." - ;; - esac - -done