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
One of the main strengths of the Perl programming language are its powerful text manipulation features. In this assignment, you will put them to  use for writing a Perl program tha

You are required to develop a program that calculates the charges for DVD rentals, where current release cost RM3.50 and all others cost RM2.50. If a customer rents several DVDs, e

Define the Parameter Passing Mechanism - Computer Programming? The Parameters are syntactically identifiers and they are used within the body of the function and sometimes the

A function that takes a list with at least 4 numbers and if three of the numbers sum is equal to the remaining numbers return #t else return #f

The languages used in the module are of a type known as high-level languages. There is another set of languages known as low-level languages. (a) Differentiate between high-leve

The software development team identified the following classes based on the analysis of given requirements: Product, Employee, ProductList, Supplier. 1.  Identify the relationsh

For this assignment you will use the robot/maze simulation example introduced in mini-assignments 0625ma-0627ma to develop a maze-solving program. The program will read a file cont

Assignment for Networing&camunication


Write a Program to illustrate the call by value? #include . int compute_sum(int m); int main( void) { int n=3, sum; printf("%d\n",n); /*3 is printed */ sum=compute_sum(n