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

 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.....

Posted Date: 9/26/2012 8:39:34 AM | Location : United States







Related Discussions:- Shell script delete all lines from file contains word mca, Assignment Help, Ask Question on Shell script delete all lines from file contains word mca, Get Answer, Expert's Help, Shell script delete all lines from file contains word mca Discussions

Write discussion on Shell script delete all lines from file contains word mca
Your posts are moderated
Related Questions
Write a program to check whether a car will crash. There is an obstacle at a certain distance (say 100 m) and the car is travelling at a certain speed (try it with some different s

1. You are working as a designer for a university that offers a program in Computer Science. One of the tracts is computer security. One of your colleagues has recommended adding a

Use list recursion to de ne the function mySum which takes as input an integer and a list of integers and returns the list obtained by adding every element of the list by the rst

#quFollow the my shell programming guidelines as in the other assignments. Write a shell script to send a customized mail message to the users listed on the command line by login (

CrowdSporting Website Development I want an advanced web developer to spend 1-2 days coding our newly designed website. It will be a single page scrolling site, fully designed a

A traveler wants to purchase a number of traveler''s checks, each having a set amount for four different currencies: Mexican pesos, Euro dollars, Swiss francs, and US dollars. A t

Question: (a) Explain the concepts of Inheritance and Polymorphism in Lingo programming. (b) Write short descriptions on parent scripts and child objects in Lingo object

Complete the following program to move a value of 0xFFH to PORTB LIST p=18f4550 #include org 0x0000 movlw 0x00 _________ movlw 0xFF movwf PORTB end .

Internal Audit has been asked by the State to review the activities of  The Commission on Workforce Development. The Commission was established several years ago by the state legis

We now require starting looking into finding a particular solution for n th order differential equations. The two ways which we'll be looking at are similar as those which we look