Shell script delete all lines from file contains word mca, Programming Languages

Assignment Help:

 Delete all such lines from a file that contains the word “MCA”.

 

echo -e "Enter the pattern : \c"

read ptrn

cnt=0

for i in `ls -1`

do

 if [ -f $i ]

 then

  l=`grep -E $ptrn $i|wc -l`

  if [ $l -gt 0 ]

  then

   rm $i

   echo "$i is deleted....."

   fi

 fi

done

 

Output

Enter the pattern : mca

temp.sh is deleted.....


Related Discussions:- Shell script delete all lines from file contains word mca

Assembly language program, a program that enter an alphabet from the user a...

a program that enter an alphabet from the user and compare it is vowel or not?

Pascal, how do i make a bomber game using pascal on a software called lazur...

how do i make a bomber game using pascal on a software called lazuras

Assignment, Assignment for Networing&camunication

Assignment for Networing&camunication

Create a linux shell, Create a linux shell (in other words, write a C/C++ p...

Create a linux shell (in other words, write a C/C++ program) that will recursively prompt for input from the user. The shell should prompt as yourRollNumber-currentDirector

Create a reservation system, Villa La Fourche Ltd is a small family busines...

Villa La Fourche Ltd is a small family business situated in the East Coast of Mauritius, more precisely Trou d'eau Douce.   The compound comprises of 6 independent villas, each of

Jsp help, what is the code to copy code on 1 jsp page to others

what is the code to copy code on 1 jsp page to others

Built a liner program to manage a staff, A manager at the local Walmart nee...

A manager at the local Walmart needs to determine how many workers to hire to cover a 24-hour period. Each worker must work 9 consecutive hours but may only start work at the begin

Mobile application in android platform phones, Recent problems in finishing...

Recent problems in finishing implementation: This mobile application is built with Sencha Touch framework. Source code is attached in this zip package. The daily rest calc

Network security, Term project (you should code a function), demonstrate it...

Term project (you should code a function), demonstrate it to the class and a very breief report (one or two pages) describing what you did. You determine your project (could be imp

C++, Have the user input two values. Store them in variables called saving...

Have the user input two values. Store them in variables called savings and expenses, both of data type double. If expenses is less than savings, subtract expenses from savings, o

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd