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
1. A readme.txt file with: a. Instructions on how to compile and run your client and server code on the command line. (Also provide shell scripts if the commands are complicated

Play is as follows: 1.) Player places a bet a. Bet is on one of three choice i. "Player" will win ii. "Banker" will win iii. Tie between the "Player" and the "Banker

Characteristics of object-oriented programming: •   Emphasis is on data rather than procedure. •   Programs are divided into what are known as objects. •

My programming class uses Virtual Logic (not virtual studio) to learn how to program algorithms but we don''t get any assistance form the instructor so I am at a loss as to how I a

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

I''m doing a project for class in college and im supposed to use today''s date and figure out how old i am in months, days, minutes, and seconds. My question is what is the beset

i attached the assignment document only i need your help with following three parts: accessible areas, accessible cul-de-sacs that are all connected, entry-exit path with no in

using UML 1- Identify primary classes 2- Scenario description 3- Class diagrams 4- Sequence diagrams

Hi how can I upload my hw to you experts?

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