I want the grep command to exist in the script.
I have the following code. I need this to be modified as per the above condition.
Your help will be appreciated.
Thanks
Expand|Select|Wrap|Line Numbers
- $fname="file.txt";
- open(FH,$fname);
- @file_content=<FH>;
- foreach (@file_content){
- my $match_text=grep {"Local=IN"},@file_content;
- Last if($match_text);
- else {
- open(WH,"temp.log");
- print WH "$\n";
- if (/Testing Option 0 ok/){
- print "Local=IN\n";
- }
- unlink($fname);
- rename(temp.log,"$fname");
- }
Find the string using grep command from the huge data file