#! /bin/sh
# Write a shell script that reads a pattern and a file name from the keyboard, if the file exist then pattern should be search on the file and display accordingly where the pattern is matched otherwise display file not found.
echo " Enter the file name "
read filename
if ls $filename
then
echo "enter the pattern "
read pattern
grep $pattern $filename
else
echo " File doesn't exist "
fi
# Write a shell script that reads a pattern and a file name from the keyboard, if the file exist then pattern should be search on the file and display accordingly where the pattern is matched otherwise display file not found.
echo " Enter the file name "
read filename
if ls $filename
then
echo "enter the pattern "
read pattern
grep $pattern $filename
else
echo " File doesn't exist "
fi



0 comments:
Post a Comment