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
Need help with a cobol program.

Please write a program declaring a variable x as the type int, and use the scanf function to input an integer to initialize the value of x. Then, your program will print the follow

I am working on a game project using C# XNA. I only have two weeks from the deadline. Would you help me to finish it up? Please let me know as soon as possible. Thanks, Sophi

Your program can be invoked with option: -d date, where date is entered in dd/mm/yyyy format. In this case, it must only print the following string: Found cookies expiring bef

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.

Provide Example of Function? An illustration of a function definition main() { message(); } /* header */ message() { /*bodystarts here*/ printf ("Example for function

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 .

What is Data Normalization and Schema Refinement? Define briefly..

Figure is a representation of the solar system. In a basic model of the same concentric orbits planets rotate around the sun. The closer the Planet in less time Sun completes a ful

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