REMOVE THE LINES IN A GIVEN PATTERN:
echo "Enter file name"
read file
echo "Enter pattern"
read pat
grep -v $pat $file
OUTPUT:
[@localhost
~]$ sh pattern.sh
Enter
file name
raja
Enter
pattern
did
HAI I AM
RAJASEKAR
I DID MY
STUDIES IN NMC
I
COMPLEATED MY PG DEGREE IN MBA AND MCA
I AM
ALWAYS BE A OVER-CONFIDENT PERSON
THEN ONLY
LEADS TO VERY SUCCESSFULL MANNER
[@localhost
~]$ sh pattern.sh
Enter
file name
raja
Enter
pattern
COMPLEATED
HAI I AM
RAJASEKAR
I DID MY
STUDIES IN NMC
I AM
ALWAYS BE A OVER-CONFIDENT PERSON
THEN ONLY
LEADS TO VERY SUCCESSFULL MANNER
[@localhost
~]$ sh pattern.sh
Enter
file name
raja
Enter
pattern
I
THEN ONLY LEADS TO
VERY SUCCESSFULL MANNER
No comments:
Post a Comment
Thanks for your valuable comments