Hello Great Monks,
I am writing a filter file to filter out some lines from two file and then compare them. Basically, I am using regular expressions to check for a line I want to be remove and then return 0 for such lines. I do not know which files will come in as the input. If the files have these lines they will be removed.
I have a different problem. In this filter file, I want to add code for removing lines between two specific tags. For example, if the file has
MYTAG1
line1
line2
line3
MYTAG2
line1
line2
I want to remove all line from MYTAG1 up untill MYTAG2 but not MYTAG2. So the file should look like after filtering:
MYTAG2
Line1
line2
What I have currently is the following code:
<CODE>if (/^MYTAG1/ .. /^MYTAG2/){
return 0;
}
But this would remove the MYTAG2 line from the file. I do not want to remove the MYTAG2.
Would using "last" help? How to use it?
Please help!
A Learning Monk!
In reply to How do I remove lines from a file... by ginju75
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |