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

Programming project, Create a visualization (programming project) and demon...

Create a visualization (programming project) and demonstrate it in the class. The project should be related to distributed systems. (A distributed system consists of multiple auton

Java, Write a program that repeatedly prompts for and reads a positive inte...

Write a program that repeatedly prompts for and reads a positive integer value n and then calculates and displays the nth Fibonacci number

Vb, sir can you help me visual basic 6.0 project solution

sir can you help me visual basic 6.0 project solution

What is url describe their protocol, What is URL describe theri protocol? ...

What is URL describe theri protocol? URL basicallt stands for uniform resource locator. A URL is a pointer to a particular resource on the Internet at a particular location.

DOM - Document Object Model, What is DOM? The Document Object Model is a pl...

What is DOM? The Document Object Model is a platform- and language-neutral interface that will allow programs and scripts to dynamically access and update the content, structure an

Python, interference of waves

interference of waves

Program for searching by indexing text files, Write a program that can faci...

Write a program that can facilitate searching by indexing text files according to words. In this task, you are given a large text file, sample.txt, which you will need to index the

Corba multiple clients, I have an assignment that requires from me to run ...

I have an assignment that requires from me to run multiple clients and one server ( Corba)

C++, fow to I write a emplate that reads a set of numbers typed at the keyb...

fow to I write a emplate that reads a set of numbers typed at the keyboard into an array of T

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