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 3 somewhat simple scripts / programs in any language, combination of languages, and/or software. Please tell me the task you are trying to accomplish in the scripts. Idea


I WANT TO MAKE PROJECT IN ARM LANGUAGE CAN YOU HELP ME

Question 1- In engineering applications it is often necessary to fit a straight line to a set of N points with known coordinates (xi, yi), where i indexes the points (N in total).


OOPS Concepts Object-oriented programming (OOP) is a computer science term used to characterize a programming language that began development in the 1960’s. The term ‘object-orient

Objective: The purpose of this programming project is to explore page replacement algorithms. This can be accomplished by developing a simple simulator that implements various pag

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Write a Program to Show Twenty Ellipses 1. Write a program to show twenty ellipses which move away from the mouse pointer. Their initial locations should be random.

1. Develop a Web page, indicating an ordered list of the names of your five friends. 2. Develop an HTML document with a nested list indicating the content page of any book 3.